Log in

No account? Create an account


Using a different X11 window manager with XQuartz

« previous entry | next entry »
13th Apr 2016 | 22:42

(In particular, i3 running on a remote machine!)

I have been rebuilding my workstation, and taking the opportunity to do some major housecleaning (including moving some old home directory stuff from CVS to git!)

Since 1999 I have used fvwm as my X11 window manager. I have a weird configuration which makes it work a lot like a tiling window manager - I have no title bars, very thin window borders, keypresses to move windows to predefined locations. The main annoyance is that this configuration is not at all resolution-independent and a massive faff to redo for different screen layouts - updating the predefined locations and the corresponding keypresses.

I have heard good things about i3 so I thought I would try it. Out of the box it works a lot like my fvwm configuration, so I decided to make the switch. It was probably about the same faff to configure i3 the way I wanted (40 workspaces) but future updates should be much easier!

XQuartz and quartz-wm

I did some of this configuration at home after work, using XQuartz on my MacBook as the X11 server. XQuartz comes with its own Mac-like window manager called quartz-wm.

You can't just switch window managers by starting another one - X only allows one window manager at a time, and other window managers will refuse to start if one is already running. So you have to configure your X session if you want to use a different window manager.

X session startup

Traditionally, X stashes a lot of configuration stuff in /usr/X11R6/lib/X11. I use xdm which has a subdirectory of ugly session management scripts; there is also an xinit subdirectory for simpler setups. Debian sensibly moves a lot of this gubbins into /etc/X11; XQuartz puts them in /opt/X11/lib/X11.

As well as their locations, the contents of the session scripts vary from one version of X11 to another. So if you want to configure your session, be prepared to read some shell scripts. Debian has sensibly unified them into a shared Xsession script which even has a man page!

XQuartz startup

XQuartz does not use a display manager; it uses startx, so the relevant script is /opt/X11/lib/X11/xinit/xinitrc. This has a nice run-parts style directory, inside which is the script we care about, /opt/X11/lib/X11/xinit/xinitrc.d/98-user.sh. This in turn invokes scripts in a per-user run-parts directory, ~/.xinitrc.d.

Choose your own window manager

So, what you do is,

    $ mkdir .xinitrc.d
    $ cat >.xinitrc.d/99-wm.sh
    exec twm
    $ chmod +x .xinitrc.d/99-wm.sh
    $ open /Applications/Utilities/XQuartz.app

(The .sh and the chmod are necessary.)

This should cause an xterm to appear with twm decoration instead of quartz-wm decoration.

My supid trick

Of course, X is a network protocol, so (like any other X application) you don't have to run the window manager on the same machine as the X server. My 99-wm.sh was roughly,

    exec ssh -AY workstation i3

And with XQuartz configured to run fullscreen this was good enough to have a serious hack at .i3/config :-)

| Leave a comment | Share

Comments {2}

Ewen McNeill


from: edm
date: 13th Apr 2016 22:20 (UTC)

For possible future reference, if you are using XQuartz installed from MacPorts ("xorg-server") as I am, it appears that the relevant xinitrc.d is at:


which has "98-user.sh" sourcing ~/.xinitrc.d/*.sh as described above, and a "99-quartz-wm.sh" that runs quartz-vm from various directories if it is present as a fallback. So adding something in ~/.xinitrc.d/*.sh as described in your post should just work there too.

Thanks for the post. It's kind of useful to know that it is actually possible to use a different WM with X11 on OS X; the default one is... pretty basic.


Reply | Thread

Tony Finch

Re: XQuartz

from: fanf
date: 13th Apr 2016 22:38 (UTC)

.xinitrc.d is an upstream feature of recent versions of xinit, so it should be fairly portable across modern xorg-based servers; you can also use the old traditional monolithic .xinitrc script. (The xinit man page seems to be poorly maintained, which is why I tend to read the scripts...)

Reply | Parent | Thread