best way to start desired X clients on login with xorg-server?
Richard Cobbe
rcobbe at pobox.com
Wed May 29 05:00:22 UTC 2019
I'm in the process of switching away from XQuartz to macports' xorg-server
package, since it seems the former is no longer supported.
I would like to start X and a client automatically upon login. Adding
/Applications/MacPorts/X11.app to the list of login items in System
Preferences is easy enough, and it starts X, but it also starts xterm, and
I'd prefer to start urxvt instead, and in a specific environment.
More precisely, I want to do the following on starting X:
1) xrdb ~/.Xresources
2) start /opt/local/bin/urxvt in environment that contains the
following variables:
LC_CTYPE=en_US.UTF_8
XDG_CONFIG_HOME=~/etc
I'd like to use quartz-wm in rootless mode, and I'd strongly prefer that
the X server continue running even if I close the urxvt started in step 2.
I'd also like to avoid having other extraneous X clients start
automatically.
I think I've found a way to do this, but it seems a bit sloppy and I'm
wondering if there's a cleaner way.
First, run the command
defaults write org.macports.X11 write app_to_run /usr/bin/true
This seems to only be necessary once; the setting appears to persist.
Then, create ~/.xinitrc with the following contents:
## Tell fontconfig to read ~/etc/fontconfig/fonts.conf
export XDG_CONFIG_HOME=~/etc
/opt/local/bin/xrdb ~/.Xresources
## start urxvt in my home directory, not the root directory
cd
LC_CTYPE=en_US.UTF_8 /opt/local/bin/urxvt &
exec /opt/local/bin/quartz-wm
If I don't change the app_to_run setting in the defaults, then I get an
xterm as well as urxvt, which is undesirable. If I just delete the
app_to_run setting, then the next time I start X, it resets app_to_run back
to its default value of /opt/local/bin/xterm, and then it starts an xterm
as well as urxvt. Setting it to /usr/bin/true (effectively a NOP) seems to
be the only way to prevent the unwanted xterm from starting and to have the
setting persist.
Is this the best way to do this?
Thanks,
Richard
More information about the macports-users
mailing list