XMonad – Clickable workspaces

One feature DWM has which is missing in XMonad is the clickable workspaces in status bar. There is a very good reason for this, which is that statusbars in XMonad are external applications i.e. XMobar and Dzen2.

To achieve clickable workspaces in XMonad with Dzen2 the following is needed:

– dzen2 (the latest SVN chekout which includes the ^ca functionality)
– XMonad
– xdotool

Include these modules in your xmonad.hs:

import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import Data.List

Comment out your current workspace listing and enter following instead:
myWorkspaces :: [String]
myWorkspaces = clickable . (map dzenEscape) $ ["1","2","3","4","5"]

where clickable l = [ "^ca(1,xdotool key alt+" ++ show (n) ++ ")" ++ ws ++ "^ca()" |
(i,ws) <- zip [1..] l,
let n = i ]

If you have any redirects in your ManageHook change them accordingly:
, className =? "Firefox" --> doF (W.shift (myWorkspaces !! 1))

If this does not work report back here: ** regj arch-ed dot dk **

Reference: McManiac @ http://bbs.archlinux.org/viewtopic.php?id=40637&p=8

  1. how do i get workspaces name instead a string ca^whatever?

  2. You should be able to define the names here:
    myWorkspaces = clickable . (map dzenEscape) $ [“Workspace 1″,”Workspace 2″,”yadayada”,”uggabugga”,”wee”]

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">