This is a guided tour of the core features of the xmonad window manager, allowing you to gain an understanding of the motivation, and use of a tiling window manager, and learn how to achieve the kind of screen configuration you want, simply and easily.
If you’re already familiar with the basics and want to learn how to configure xmonad and customize it to your liking, head over to the configuration tutorial.
We’ll assume you’ve been able to install xmonad and set it as your window manager.
When you start xmonad, without launching clients, you’ll be presented with an empty screen:
Let’s start some clients, to fill the screen. xmonad uses the mod1 key (alt) by default, and we can start by launching a terminal with mod-shift-return. The new terminal will fill the screen (and we’ll use a bit of image processing to contrast the terminals a bit for the tutorial):
Let’s open up another terminal mod-shift-return:
The window manager has now tiled the screen such that both windows fit, without overlaps, filling the plane. Note that the new window was inserted to the left of the previous window. What happens if we insert another client? mod-shift-return.
xmonad uses a simple tiling algorithm to tile the windows to fill the screen without gaps, while ensuring space is managed in a reasonable way. xmonad, by default, divides the screen into two panes. All windows are then partitioned into these two panes. The ratio each pane takes up on the screen is configurable, as are the number of clients in each pane. By convention, one pane is denoted as the ‘master’ pane, and is used to place the largest window. Other tiling algorithms are possible, (for example, fullscreen mode, or floating windows), and in these the concept of a ‘pane’ has no real meaning.
We can try out the other layouts now, with mod-space, which cycles through the available tiling algorithms:
The next mode up is the ‘wide’ mode, a 90-degree rotation of the initial tiling. This is useful for smaller screens. If we hit mod-space again, we end up in fullscreen mode, where the currently focused window is maximised, and the only visible window:
Other tiling algorithms may be written directly in configuration files.
Let’s return now to the original ‘tall’ tiling, mod-space. We can move focus around with the mouse, or with mod-j and mod-k (which moves the window focus up or down) (coloured red here for emphasis):
We can also increase, or decrease, the number of windows stored in the master pane, with mod-comma and mod-period:
and again mod-comma:
Use mod-period a few times to decrement the master pane count back to 1, to return to the default tiling.
Now, let’s open up another client, we’ll launch glxgears:
We can shuffle the window ordering in three ways: mod-return, mod-shift-j and mod-shift-k. First, let’s try mod-return, which swaps the focused window with the window in the master pane:
mod-shift-j (and its inverse, mod-shift-k), swap the currently focused window with its neighbour above or below. This allows us to ‘bubblesort’ the window ordering, to achieve a desired ordering of windows. Applying mod-shift-j twice:
and we’re back where we started.
We can resize the ratio between the master and subordinate areas with mod-h and mod-l. Hitting mod-h a few times:
Now, let’s cycle to wide mode, and shrink (mod-space, then mod-l):
We can return to tall mode by cycling through the tiling modes some more.
xmonad supports
When a window is closed naturally, or using mod-shift-c to kill it, focus is moved to the next window down in the workspace list. Let’s kill glxgears. Focus should move to the xterm below it:
To fully quit xmonad, use mod-shift-q to exit X (don’t do that now!).
Assuming you have installed ‘dmenu’, you can launch programs from the status bar, by typing a few characters of the program’s name. Use mod-p to launch dmenu, and then type ‘fir’ to find firefox:
After firefox launches, it is inserted above the focused window:
Now, let’s close a terminal, use mod-space to enter wide mode, and mod-return to move firefox into the master window:
xmonad has by default 9 virtual workspaces. Each physical screen is a portal onto one of these workspaces. The relationship between physical screens and virtual workspaces is described by the following image, which shows a conceptual model of xmonad, with 2 physical screens acting as portals onto 5 virtual workspaces.
You can switch between workspaces using mod-1 to mod-9. Switching to workspace 4 mod-4 we find it empty:
Let’s open xclock here, using dmenu:
We can now move firefox from workspace 1 to this new workspace 4, by first switching back to workspace 1, mod-1, then using mod-shift-4 on firefox’s window, to toss it over to #4. This removes firefox from workspace 1, passing focus there to the next window in the list, and view workspace 4, after
Workspace 4 is using tall tiling, and workspace 1 is still in wide mode. xmonad allows you to run different tiling modes on each workspace. And that is the core set of window manager operations covered:
Please consult the man page for more details. With just these basics it should be possible to get started productively using xmonad as your tiling window manager. With custom configuration in Haskell, you can try out all sorts of interesting tiling or key binding ideas quite cheaply, as well as producing nice eye candy.
Throw away the mouse, and get productive in X!