Today I learnt how to make i3wm, or indeed any other window manager capable of running shell commands, to work nicely with Gnome.
Update 2016-08-06: The instructions here now also support Ubuntu 16.04 and probably also other dists using similarly modern Gnome.
Way back, I was the main culprit of plwm, a window manager in pure Python. When returning to X after several years in the wilderness I did try the regular Gnome stuff, but gave up on it and found i3wm instead, as it not only is excellent at keyboard navigation, it also implements some very good tiling support. Even so, a modern Linux system is easier to use if the Gnome panel and the settings daemon are present.
Configuring the system
To get both worlds you have to define an i3wm session so that Gnome understands it, by adding two files to the system configuration:
First create /usr/share/xsessions/gnome-i3.desktop
to add a Gnome
with i3 alternative to the login screen:
[Desktop Entry]
Name=GNOME with i3
Comment=A GNOME fallback mode session using i3 as the window manager.
Exec=gnome-session --session=gnome-i3
TryExec=gnome-session
Icon=
Type=Application
DesktopNames=GNOME-Flashback;Unity;
X-Ubuntu-Gettext-Domain=gnome-flashback
Then define what to start in that session in
/usr/share/gnome-session/sessions/gnome-i3.session
:
[GNOME Session]
Name=gnome-i3
RequiredComponents=gnome-panel;unity-settings-daemon;i3;gnome-flashback-services;
i3wm must also be defined as an application in
/usr/share/applications/i3.desktop
, which it already may be by the
standard Linux dist packages:
[Desktop Entry]
Type=Application
Name=i3
NoDisplay=true
Comment=improved dynamic tiling window manager
Exec=i3
X-GNOME-WMName=i3
X-GNOME-Autostart-Phase=WindowManager
X-GNOME-Provides=windowmanager
#X-GNOME-Autostart-Notify=false
So far, this had been working fine for a year, except that it took a minute or so for gnome-panel to actually start. No big deal. After the latest update Gnome instead shut down and logged me out after a minute. It seems the behaviour changed from just giving up waiting on i3wm to announce itself in the Gnome way and proceeding anyway, to treating this as a fatal failure.
Configuring i3wm
The trick is to have i3wm tell Gnome that it has started, via dbus.
Notice the uncommented line in i3.desktop
above, and then add these
two lines to ~/.i3/config
:
exec --no-startup-id echo "$0: DESKTOP_AUTOSTART_ID $DESKTOP_AUTOSTART_ID, registering with org.gnome.SessionManager"
exec --no-startup-id dbus-send --session --print-reply=literal --dest=org.gnome.SessionManager "/org/gnome/SessionManager" org.gnome.SessionManager.RegisterClient "string:i3" "string:$DESKTOP_AUTOSTART_ID"
(I cannot now refind the page that gave me this hint, but thanks to whoever posted it!)
Indeed, this trick should work with any other non-Gnome window manager, including good old plwm.