Xmonad in Ubuntu 12.04 with Unity 2D

I've been using xmonad in ubuntu for quite a while. The change from 11.04 to 12.04 involved the following steps.

Xmonad in Ubuntu 12.04 with Unity 2D

I started with the official documentation, but it wasn't quite accurate anymore. Maybe it worked for 11.10, which I chose to skip. Note that the unity shell is not used here.

In this setup, xmonad-gnome-session.desktop calls /usr/bin/gnome-session-xmonad which calls xmonad.session.

/usr/share/applications/xmonad.desktop

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Xmonad
Exec=xmonad
NoDisplay=true
X-GNOME-WMName=Xmonad
X-GNOME-Autostart-Phase=WindowManager
X-GNOME-Provides=windowmanager
X-GNOME-Autostart-Notify=true

/usr/share/gnome-session/sessions/xmonad.session

[GNOME Session]
Name=Xmonad Unity-2D Desktop
RequiredComponents=gnome-settings-daemon;
RequiredProviders=windowmanager;panel;
DefaultProvider-windowmanager=xmonad
DefaultProvider-panel=unity-2d-panel

/usr/share/xsessions/xmonad-gnome-session.desktop

[Desktop Entry]
Name=GNOME with Xmonad
Comment=A GNOME fallback mode session using xmonad as the window manager.
Exec=gnome-session-xmonad
TryExec=gnome-session
Icon=
Type=Application

/usr/bin/gnome-session-xmonad

#! /bin/sh
exec gnome-session --session xmonad "$@"

xmonad.hs

myManageHook = composeAll [
  -- other hooks,
  , className =? "Unity-2d-panel"    --> doIgnore
  -- more hooks 

Skip the advice on the web about gaps if you're already using managedocks. Managedocks includes avoidstruts, which is preferred.

When logging in, click the icon and select the configuration above.

Unity 2D Configuration

I learned a few things along the way. dconf-editor replaces gconf-editor in unity 2d, and it will be the replacement for unity 3d in the future. Note that unity 2d is all new as opposed to 3d, which relies on compiz. dconf addresses configuration for data providers, scopes, and lenses among other things.

sudo apt-get install dconf-tools
sudo dconf-tools
# see com/canonical/indicator/datetime, click show-date

Unity 2D Keyboard Configuration with setxkbmap

My previous solution to using both a laptop keyboard and a separate keyboard will not work under unity 2d. I've revised it to be:

kbd.rb

 1 #! /usr/bin/env ruby
 2 
 3 def apple
 4   `setxkbmap -option "" -option grp:shift_caps_toggle -option altwin:swap_lalt_lwin`
 5 end
 6 
 7 def pc
 8   `setxkbmap -option "" -option grp:shift_caps_toggle`
 9 end
10 
11 def swap
12   `setxkbmap -query` =~ /lalt_lwin/ ? pc : apple
13 end
14 
15 val = case ARGV[0]
16 when 'apple'
17   apple
18 when 'pc' 
19   pc
20 else
21   swap
22 end
comments powered by Disqus