You can probably downloaded a precompiled version of xmonad for your
distribution, but to change any of the defaults you must do so by
editing a config file written in Haskell and recompile (this is
extremely quick). But I've found that there are not many changes I want
to make, and for the few I did need I found examples on the Internet
that I could copy and adapt without actually learning Haskell. In fact,
you don't need to do that, as the documentation for Xmonad explains.
The main change I needed to make was the 'Mod key'. By default, Xmonad
uses the Alt key plus other keys for commands. So Shift-Alt-Return opens a
window with a new xterm, Shift-Alt-c closes a window, Alt-tab switches between
windows, etc. This is fine unless you need your Alt key for something
else, which you may well do. In my case, for example, I'd made a lot of
Vim macros with Alt and I didn't want to change them.
Changing the default Mod key
Xmonad makes it easy to use a different key as the Mod key. It suggests
the Windows key, which is Mod4 instead of Mod1 (used for Alt). Of
course, you may not have a Windows key; how to solve this is discussed
below.
Assuming you do have a Windows key, you first have to make a file called
~/.xmonad/xmonad.hs, and insert a few lines of code.
You can now either restart Xmonad or do 'xmonad --recompile' at a
terminal within Xmonad. If any error is reported you have probably
mistyped something, so check and try again. If there are no errors, your
Mod key is now the Windows key.
The xmonad.hs file I've just quoted is pretty basic and does only
one thing. Here is a link to my xmonad.hs
file which includes more information.
What if I don't have a Windows key?
I don't have this key on
my Thinkpad T43 and I thought I was going to have a problem, but there
is a simple solution. The Windows key actually generates Super_L, so
this is what you use. Choose another key and redefine it to be Super_L,
using xmodmap:
xmodmap -e "keycode xx = Super_L"
To find out what is the key code for your chosen key, use xev.
Having got this working, you can put the above xmodmap command in your
~/.xinitrc file so that it is run automatically when you start X.
Editing your .xinitrc file
Of course, you will lose the normal function of the key you assign as a
Windows key, so choose it wisely. The useless and annoying CapsLock key
is a good choice; on my computer its key code is 66. You will need an
extra line to make it available. There are a couple of other things
needed as well, to make the cursor work properly and to set the
language, if you don't want US. Here is my ~/.xinitrc file, with
comments.
# Next line gives a proper arrow pointer in Xmonad instead
# of just a cross ('X').
xsetroot -cursor_name left_ptr
#
# set your keyboard layout for your preferred language.
setxkbmap -layout gb
#
# The place of the xmodmap lines seems to matter - they
# should come before 'exec xmonad', which should be last.
#
# Make CapsLock (66) give Super_L (Windows).
/usr/bin/xmodmap -e "clear Lock"
/usr/bin/xmodmap -e "keycode 66 = Super_L"
#
exec xmonad
Launching programs
To launch a program you can just type its name in a text terminal, but
you can also use a simple command line menu. Two of
these are used by default in xmonad: dmenu and gmrun. You install these
separately from xmonad, and launch them with Mod-p or Mod-Shift-p. In
both cases you just start typing the name of the program you want to run
in the floating window; once there are sufficient letters to identify it
you can press Tab to complete the name.
Note that some applications seem to work better when they are started
from a menu rather than a text terminal. One of these, for me, is xsane.
Conclusion
Xmonad will certainly not suit everyone but
I hope these notes will be useful to
anyone who is thinking of trying it but is discouraged by the need to
use Haskell to configure it. My own preference these days is for
spectrwm. There is information about this on my blog.