Browse Source

Add a clickable xmobar

Joshua Bicking 6 years ago
parent
commit
c46a1d3d9b
2 changed files with 13 additions and 2 deletions
  1. 2 2
      xmonad/.xmobarrc
  2. 11 0
      xmonad/.xmonad/xmonad.hs

+ 2 - 2
xmonad/.xmobarrc

@@ -11,7 +11,7 @@ Config {
    -- layout
    , sepChar =  "%"   -- delineator between plugin names and straight text
    , alignSep = "}{"  -- separator between left-right alignment
-   , template = "}%StdinReader%{"
+   , template = "}%UnsafeStdinReader%{"
 
    -- general behavior
    , lowerOnStart =     False    -- send to bottom of window stack on start
@@ -36,6 +36,6 @@ Config {
    --   color can be set by enclosing in <fc></fc> tags. For more details
    --   see http://projects.haskell.org/xmobar/#system-monitor-plugins.
    , commands = [
-       Run StdinReader
+       Run UnsafeStdinReader
      ]
 }

+ 11 - 0
xmonad/.xmonad/xmonad.hs

@@ -35,6 +35,16 @@ myTerminal   = "konsole"
 myPP = xmobarPP { ppTitle = \_ -> ""
                 , ppLayout = \_ -> ""}
 
+-- Make xmobar workspaces clickable
+xmobarEscape = concatMap doubleLts
+  where doubleLts '<' = "<<"
+        doubleLts x   = [x]
+myWorkspaces = clickable . (map xmobarEscape) $ map show [1..9]
+  where
+    clickable l = [ "<action=xdotool key super+" ++ show (n) ++ ">" ++ ws ++ "</action>" |
+                             (i,ws) <- zip [1..9] l,
+                            let n = i ]
+
 main = do
   -- Spawn an xmobar on each screen
   nScreen <- countScreens
@@ -42,6 +52,7 @@ main = do
 
   xmonad $ ewmh $ docks $ kde4Config {
     manageHook = manageDocks <+> myManageHook <+> manageHook kde4Config
+  , workspaces = myWorkspaces
   , layoutHook = avoidStruts $ desktopLayoutModifiers $ smartBorders $
                  (smartSpacing 5 $ withBorder 2 $ Tall 1 (3/100) (1/2)) |||
                  (smartSpacing 5 $ withBorder 2 $ Mirror (Tall 1 (3/100) (1/2))) |||