XMonad Configuration

1 March 2013

Default Keybindings

xmonad
Mod-Shift-Q Quit xmonad
Mod-Q Restart xmonad
Programs
Mod-Shift-C Kill focused window
Mod-Shift-P gmrun
Mod-P dmenu
Mod-Shift-Return Run terminal
Xinerama
Mod-Shift-W Move window to Xinerama 1
Mod-W Focus Xinerama 1
Mod-Shift-E Move window to Xinerama 2
Mod-E Focus Xinerama 2
Mod-Shift-R Move window to Xinerama 3
Mod-R Focus Xinerama 3
Workspaces
Mod-Shift-1 Move window to workspace 1
Mod-1 Switch to workspace 1
Mod-Shift-2 Move window to workspace 2
Mod-2 Switch to workspace 2
Mod-Shift-3 Move window to workspace 3
Mod-3 Switch to workspace 3
Mod-Shift-4 Move window to workspace 4
Mod-4 Switch to workspace 4
Mod-Shift-5 Move window to workspace 5
Mod-5 Switch to workspace 5
Mod-Shift-6 Move window to workspace 6
Mod-6 Switch to workspace 6
Mod-Shift-7 Move window to workspace 7
Mod-7 Switch to workspace 7
Mod-Shift-8 Move window to workspace 8
Mod-8 Switch to workspace 8
Mod-Shift-9 Move window to workspace 9
Mod-9 Switch to workspace 9
Layouts
Mod-N Refresh viewed sizes
Mod-T Tile floating window
Mod-Mouse-1 Float and move
Mod-Mouse-2 Raise
Mod-Mouse-3 Float and resize
Master area
Mod-H Shrink master area
Mod-L Expand master area
Mod-M Focus master window
Mod-Return Swap focused window
Mod-Comma (,) More master windows
Mod-Period (.) Fewer master windows
Windows
Mod-Shift-Tab Focus previous window
Mod-Tab Focus next window
Mod-Shift-J Swap with next window
Mod-J Focus next window
Mod-Shift-K Swap with previous window
Mod-K Focus previous window

Basic Configuration

Shortly after I reported the bug with Dvorak keyboard support in Gnome and discovered that it was a feature, I switched to XMonad. I had been a long-time user of ratpoison, although I was eventually forced to give it up due to its handling of must-float windows like Gimp's.

Switching to XMonad was the best thing I have done in a very long time. It made computing fun again. (It solves the problems I was having with ratpoison by supporting floating windows.)

The configuration I have worked up so far is pretty minimal, with the modifier key mapped to the Windows key:

myModMask = mod4Mask

I currently have a pretty good set of keyboard controls:

  • I use setWMName to set up the window manager identifier to support broken Java X support.

  • I use windowPromptGoto to (rarely) visit windows by title.

  • I have a quick date pop-up, and a way of adding quick notes to a file.

  • And finally, I recently added actions for XMonad.Actions.CycleWS to meander through my workspaces and multiple Xinerama displays:

    myKeys x =
        [
         ((modMask x .|. controlMask .|. shiftMask, xK_z), setWMName "LG3D"), -- @@ Java hack
         ((modMask x .|. controlMask .|. shiftMask, xK_l), setWMName "compiz"), -- @@ Java hack
         ((modMask x, xK_g), windowPromptGoto  defaultXPConfig),
         ((modMask x, xK_d), date),
         ((modMask x .|. controlMask, xK_n), appendFilePrompt defaultXPConfig "/home/mcguire/NOTES"),
         ((modMask x, xK_s), shellPrompt defaultXPConfig),
         ((modMask x, xK_Left), prevWS >> showCurrentWS),
         ((modMask x, xK_Right), nextWS >> showCurrentWS),
         ((modMask x, xK_Up), prevScreen >> showCurrentWS),
         ((modMask x, xK_Down), nextScreen >> showCurrentWS),
         ((modMask x, xK_Page_Up), windows focusUp),
         ((modMask x, xK_Page_Down), windows focusDown),
         ((modMask x, xK_w), showCurrentWS)
        ]
    
    keyMap x = M.union (keys defaultConfig x) (M.fromList (myKeys x))
    

One feature that I added myself is the ability to display briefly the name of a Workspace when switching to it. showCurrentWS is an X () action handling that, although it seems to have a strange problem in that it must be linked with another X action; it does not work with the M4-w command.

The function is:

showCurrentWS :: X ()
showCurrentWS = withWindowSet ((flip dzen) (5 `seconds`) . currentTag)

This command uses dzen to display the title, for five seconds. The text that is displayed is the currentTag of the windowSet.

It depends on the following imports:

import XMonad.Actions.CycleWS

import XMonad.Util.Dzen

import XMonad.Core
import XMonad.StackSet

The configuration is brought together by:

main = xmonad $ defaultConfig
       {
         modMask = myModMask,
         keys = keyMap,
         logHook = ewmhDesktopsLogHook,
         layoutHook = tabbed shrinkText defaultTheme ||| (layoutHook defaultConfig)
       }
  • I am using the xterm terminal, rather than gnome-terminal or any of the other, larger programs.
  • I usually use a tabbed layout, with the window titles (if there is more than one on the workspace) showing above the windows themselves.

gloria i ad inferni
faciamus opus

Return to Top | About this site...
Last edited Mon Feb 17 17:17:22 2014.
Copyright © 2005-2016 Tommy M. McGuire