I just got a new "Bonobo" laptop from System 76 (which comes with Ubuntu 10.04 Lucid Lynx installed); and I set it up with xmonad, a nice clean, tiling window-manager. But instead of messing around with .xsession
, I'm launching it via the "hybrid" method detailed on the xmonad haskell wiki. With this mechanism, I can still login to x with the default gnome desktop — but now I can also log in with xmonad; plus I can keep the gnome-panel etc that comes with the default ubuntu install. Also, this is pretty much the simplest way to set up xmonad on Lucid.
1. Install Xmonad
So the first thing is to install xmonad:
$ sudo apt-get xmonad
2. Create an Xmonad.start Script
Now crate a shell script to execute when you login with an xmonad session. It will simply set the WINDOW_MANAGER
environment variable to xmonad
, and then start up gnome in the regular fashion:
$ sudo echo '#!/bin/sh export WINDOW_MANAGER=xmonad gnome-session' > /usr/local/bin/xmonad.start $ sudo chmod +x /usr/local/bin/xmonad.start
3. Update Xmonad.desktop
Lucid has already created an xmonad.desktop
entry in /usr/share/applications
and /usr/share/xssessions
for you; you just need to update them to run your xmonad.start
script (instead of running xmonad
directly):
$ sudo perl -pi -e 's/^Exec=xmonad$/Exec=xmonad.start/' /usr/share/{applications,xsessions}/xmonad.desktop
4. Set up Xmonad.hs
If you want some sort of dock displayed (like gnome-panel, dzen, xmobar, etc.) you need to set up a custom .xmonad/xmonad.hs
configuration file; and make sure you include manageDocks
in the manageHook
, and avoidStruts
in the layoutHook
(and you need to import XMonad.Hooks.ManageDocks
for this).
You can try out my xmonad.hs, or this simplified xmonad.hs:
import XMonad
import XMonad.Hooks.ManageDocks
import XMonad.Layout.Grid
import XMonad.Layout.Master
-- automatically manage docks (gnome-panel/dzen/xmobar/etc)
myManageHook = manageDocks
-- each layout is separated by |||
-- layout 1: grid w/ master (expand/contract by 3/100; master takes up 1/2 of screen)
-- layout 2: standard full (master window fullscreen, hides dock)
myLayoutHook = (avoidStruts $ mastered (3/100) (1/2) $ Grid) ||| Full
main = xmonad $ defaultConfig {
manageHook = myManageHook <+> manageHook defaultConfig,
layoutHook = myLayoutHook
}
After editing xmonad.hs, validate it with the following command:
$ xmonad --recompile
If you're already running xmonad, you can reload it with the new config by pressing <mod>-q.
5. Try it Out
You're all ready to try it out! Log out of your current x session (ie the Log Out... menu item in the gnome-panel), and on the login screen, select XMonad from the Sessions menu on the login screen's bottom panel:
If you're new to xmonad, follow the rest of the xmonad guided tour. If you screwed up something and xmonad won't start or appears to hang, hit <ctrl>-<shift>-<f1> to get to a terminal, login, fix xmonad.sh (with xmonad --recompile to check that it compiles), and then restart x with sudo service gdm restart.
Here's the finished product on my laptop:
No comments:
Post a Comment