Make clicking on a workspace in xmobar switch to it

master
Lars Vierbergen 8 years ago
parent a83d7f66b1
commit ed6f4c8ca1
  1. 4
      .xmobarrc
  2. 13
      xmonad.hs

@ -9,9 +9,9 @@ Config { font = "-*-Fixed-Normal-R-Normal-*-13-*-*-*-*-*-*-*"
, Run Battery ["-t", "<acstatus>", "-L", "10", "-H", "80", "-l", "red", "-h", "green", "--", "-O", "<fc=blue><left>%</fc>", "-i", "<fc=blue><left>%</fc>", "-o", "Bat: <left>% / <timeleft>"] 10
, Run Locks
, Run PipeReader "/home/lars/.xmonad/actiondisplay" "action"
, Run StdinReader
, Run UnsafeStdinReader
]
, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader% }{ %action% | %locks% | <action=`gnome-power-statistics`>%battery%</action> | <action=`gnome-system-monitor`>%cpu% | %memory% * %swap%</action> | <fc=#ee9a00>%date%</fc>"
, template = "%UnsafeStdinReader% }{ %action% | %locks% | <action=`gnome-power-statistics`>%battery%</action> | <action=`gnome-system-monitor`>%cpu% | %memory% * %swap%</action> | <fc=#ee9a00>%date%</fc>"
}

@ -53,6 +53,16 @@ workspaceManageHook = composeAll [
,className =? "Clementine" --> doShift "8:media"
]
xmobarAction :: String -- action
-> String -- output string
-> String
xmobarAction action = wrap t "</action>"
where t = concat ["<action=`", action, "`>"]
xmobarSwitchWs :: String -> String
xmobarSwitchWs wsName = xmobarAction action wsName
where action = concat ["xdotool key ISO_Level3_Shift+F", workspace]
workspace = takeWhile (/=':') wsName -- Takes all chars until ':'
main = do
xmobar_proc <- spawnPipe "xmobar"
@ -61,7 +71,8 @@ main = do
{ manageHook = (scratchpadManageHook $ W.RationalRect 0.0 0.0 1.0 0.5) <+> workspaceManageHook <+> fullscreenManageHook <+> manageDocks
, logHook = dynamicLogWithPP xmobarPP
{ ppOutput = hPutStrLn xmobar_proc
, ppTitle = xmobarColor "green" "" . shorten 50
, ppHidden = xmobarSwitchWs
, ppTitle = xmobarColor "green" "" . shorten 80
, ppSort = fmap(.scratchpadFilterOutWorkspace) (ppSort xmobarPP)
, ppOrder = \(ws:_:t:_) -> [ ws, t]
}

Loading…
Cancel
Save