TypeMatrix Special Keys In XMonad

Posted on May 7, 2012

I got a http://www.typematrix.com|TypeMatrix Keyboard recently. It has a few buttons for starting up some applications directly, which did not work out of the box in my http://xmonad.org|xmonad setting.

A little playing with xev lets us add a few keys to ~/.xmonad/xmonad.hs:

import XMonad
import XMonad.Config.Xfce
import XMonad.Util.EZConfig (additionalKeys)

main = xmonad $ xfceConfig
         { modMask = mod4Mask,
           terminal = "xfce4-terminal"}
         `additionalKeys` [ ((mod4Mask, xK_F5), spawn "virtualbox --startvm Vista"),
                            ((mod4Mask, xK_F2), spawn "emacs"),
                            ((mod4Mask, xK_F3), spawn "firefox"),
                            ((mod4Mask, xK_F4), spawn "thunar"),
                            -- Typematrix special keys
                            -- fn-sleep:
                            ((0, 0x1008ff2f), spawn "dbus-send --system --print-reply --dest=org.freedesk\
top.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend"),
                            -- Web browser
                            ((0, 0x1008ff18), spawn "firefox"),
                            -- EMail
                            ((0, 0x1008ff19), spawn "evolution"),
                            -- Calculator
                            ((0, 0x1008ff1d), spawn "xfce4-terminal -e \"ghci\"")

This works very well for me, let me know if you make use of this and whether you needed to change anything!