소스 검색

Add a clickable xmobar

Joshua Bicking 6 년 전
부모
커밋
c46a1d3d9b
2개의 변경된 파일13개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      xmonad/.xmobarrc
  2. 11 0
      xmonad/.xmonad/xmonad.hs

+ 2 - 2
xmonad/.xmobarrc

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

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

@@ -35,6 +35,16 @@ myTerminal   = "konsole"
 myPP = xmobarPP { ppTitle = \_ -> ""
 myPP = xmobarPP { ppTitle = \_ -> ""
                 , ppLayout = \_ -> ""}
                 , 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
 main = do
   -- Spawn an xmobar on each screen
   -- Spawn an xmobar on each screen
   nScreen <- countScreens
   nScreen <- countScreens
@@ -42,6 +52,7 @@ main = do
 
 
   xmonad $ ewmh $ docks $ kde4Config {
   xmonad $ ewmh $ docks $ kde4Config {
     manageHook = manageDocks <+> myManageHook <+> manageHook kde4Config
     manageHook = manageDocks <+> myManageHook <+> manageHook kde4Config
+  , workspaces = myWorkspaces
   , layoutHook = avoidStruts $ desktopLayoutModifiers $ smartBorders $
   , layoutHook = avoidStruts $ desktopLayoutModifiers $ smartBorders $
                  (smartSpacing 5 $ withBorder 2 $ Tall 1 (3/100) (1/2)) |||
                  (smartSpacing 5 $ withBorder 2 $ Tall 1 (3/100) (1/2)) |||
                  (smartSpacing 5 $ withBorder 2 $ Mirror (Tall 1 (3/100) (1/2))) |||
                  (smartSpacing 5 $ withBorder 2 $ Mirror (Tall 1 (3/100) (1/2))) |||