[FAQFlow #1]: XMonad

WTF is a FAQFlow? See [1] in the footnotes at the end of this post.

XMonad is a window manager for unix systems written in Haskell. This is a introductory post on how to use it.

First things first: grab XMonad. You might either install it manually or use the package manager from your system. Got it? Nice. Now prepare yourself to start it. How to do that? It depends.

If you’re using X11 with a display manager, you probably know how to proceed. If, instead, you don’t use a DM, the simplest way today is to put

exec xmonad

at the end of your ~/.xinitrc file. Now just run startx.

Now it’s complaining time!

  1. xmonad is lightweight but ghc (haskell compiler) is way too big (> 400MB+), do I really need it? Yes, you do, at least if you really want get the most out of xmonad. This is part of the game. If you already play with haskell, this won’t be a problem for you; however, if you don’t, read more about GHC here, and you’ll see there is a good reason for it to be that big.
  2. I just started xmonad. But there is nothing on my screen, it is blank all over the place! Help!!!? This is normal. Xmonad is lightweight! There is nothing fancy to get into your way. If you think that there should be lots of widgets, desktop icons and such things out there, maybe you should get used to a easier tiling window manager first. i3 is a good choice.
  3. Okay, I’m fine. But how do I open a terminal? Mod+Shift+Enter. Mod is usually the Alt key, but it can be changed to the windows key later on.


Yay, now we have a terminal. What’s next? xmonad(1), of course! I mean, see the man page of xmonad.

  1. How to change workspaces? Wait…xmonad has workspaces, right? Yes. Mod-1, Mod-2…and so on.
  2. How to change layouts? Mod-Space. It will cycle through the three (default) available layouts.

Now you know how to use xmonad. This post ends here, goodbye.

No, seriously, let’s dig up a little bit.

3. I don’t like xterm! It is way too ugly! Can I change the default terminal emulator?

Of course, bro! For that, we will need to create a config file for xmonad. By default, its place is ~/.xmonad/xmonad.hs. So, let’s go:

mkdir ~/.xmonad
cd ~/.xmonad
vim xmonad.hs

Now it should look like:

import XMonad

main = xmonad defaultConfig
        -- set your terminal. Examples: konsole, gnome-terminal, urxvt
        terminal = "urxvt"

We just entered some haskell code. The file is pretty self-describing at this point, right? I’ll just say that lines beginning with “–” are comments. Now just change “urxvt” for your favorite terminal emulator and run xmonad –recompile. This will make ghc compile the xmonad.hs source file. Do a “ls” now and you’ll see the good results — that is, supposing the compilation was successful.

Now is the time to restart xmonad. Run xmonad –restart. And now close your current terminal emulator and open a new one again (Mod-Shift-Enter). Done, now you have a pretty terminal [2].

This post will have a continuation.


[1]: A new way I’m trying to both document and teach new (introdutory(?)) skills or tutorials to people in this blog. The word is a portmanteau of “FAQ” (frequently asked questions) and workflow.

[2]: This is not a complaint per se; of course, one might just customize ~/.Xresources to get a nice looking xterm(1). But most people either don’t even know what a Xresources file is, or don’t bother about creating one once they found out its purpose.

[FAQFlow #1]: XMonad