best way to start desired X clients on login with xorg-server?

Richard L. Hamilton rlhamil at smart.net
Wed May 29 08:10:56 UTC 2019


I got rid of the default app to start the same way, for similar reasons.

AFAIK, the one program that xinit starts via its rc scripts in foreground that keeps running in foreground, is what it waits on - what keeps the session alive. Making that the window manager is a reasonable solution.

While the system xinitrc does plenty you don't want, it might still be worth looking at; having an ~/.xinitrc.d directory with separate files for different setup actions, running xmodmap if the files for it are present, etc, may be useful.

Give or take that, I don't see anything sloppy about what you describe; it seems perfectly reasonable for what you want.

You may have reached the point where you now know a little more about what you're doing than you believe. :-) Congratulations.

OTOH, there's always something waiting around the corner to bite you; with something sufficiently complicated, even the folks that wrote it can occasionally be surprised.

Confident caution, that's the balance you're looking for. :-)

One thing to add before starting urxvt if you want color to work!!
export TERMINFO=/opt/local/share/terminfo

because the rxvt-unicode-256color entry is only there, not in /usr/share/terminfo.  I noticed that as soon as I installed urxvt and ran the system version of vi or vim (as opposed to the MacPorts version, which will look in the MacPorts terminfo directory without being told).

> On May 29, 2019, at 01:00, Richard Cobbe <rcobbe at pobox.com> wrote:
> 
> 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