Tuesday, November 27, 2007

X11 on Leopard, auto-launch is awesome

Being used to Tiger's version of X11, I automatically started an X11 session at the start of the day to enable X11 port forwarding from our Linux servers. It has annoyed me that Leopard starts an xterm window every single time and having looked through the xinitrc files an seeing no mention of an xterm on launch was driving me batty.

I finally got fed up enough today to start hunting the InterWeb for a solution and found this page that gave me several tidbits of good news. First is that X11 is now an on-demand service, and will start when it is needed. Second, the /App/Utils/X11.app is not a link to the service itself, but really a link to starting an xterm via the on-demand launchd X11 service. Hence I was starting that xterm myself! D'oh!

This has two practical implications for my work method. First, that I don't need to manually start the X11 service anymore. Second, that I must remove the DISPLAY env setting from my bash profile. That last bit is important, hence the emphasis. If set, the DISPLAY env will basically cause the on-demad service to not work.

I tested out connecting via SSH to our servers and launching an xterm. As advertised, once the DISPLAY setting was removed from my profile, the xterm from the server started the X11 service as needed and displayed correctly.

Now if Apple fixes those Spaces bugs, everything will be all good.