diff --git a/.xmobarrc b/.xmobarrc index a9b6f76..db56bcf 100644 --- a/.xmobarrc +++ b/.xmobarrc @@ -9,9 +9,9 @@ Config { font = "-*-Fixed-Normal-R-Normal-*-13-*-*-*-*-*-*-*" , Run Battery ["-t", "", "-L", "10", "-H", "80", "-l", "red", "-h", "green", "--", "-O", "%", "-i", "%", "-o", "Bat: % / "] 10 , Run Locks , Run PipeReader "/home/lars/.xmonad/actiondisplay" "action" - , Run StdinReader + , Run UnsafeStdinReader ] , sepChar = "%" , alignSep = "}{" - , template = "%StdinReader% }{ %action% | %locks% | %battery% | %cpu% | %memory% * %swap% | %date%" + , template = "%UnsafeStdinReader% }{ %action% | %locks% | %battery% | %cpu% | %memory% * %swap% | %date%" } diff --git a/xmonad.hs b/xmonad.hs index c726aab..177e56c 100644 --- a/xmonad.hs +++ b/xmonad.hs @@ -53,18 +53,29 @@ workspaceManageHook = composeAll [ ,className =? "Clementine" --> doShift "8:media" ] +xmobarAction :: String -- action + -> String -- output string + -> String +xmobarAction action = wrap t "" + where t = concat [""] + +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" spawn "exec ~/.xmonad/action-manager/start.sh ~/.xmonad/actiondisplay ~/.xmonad/actioncontrol --state-file ~/.xmonad/actionstate --redshift-enabled --redshift-location 51:5 --redshift-temperature 6000:2000" xmonad $ baseConfig { 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 - , ppSort = fmap(.scratchpadFilterOutWorkspace) (ppSort xmobarPP) - , ppOrder = \(ws:_:t:_) -> [ws, t] - } + , logHook = dynamicLogWithPP xmobarPP + { ppOutput = hPutStrLn xmobar_proc + , ppHidden = xmobarSwitchWs + , ppTitle = xmobarColor "green" "" . shorten 80 + , ppSort = fmap(.scratchpadFilterOutWorkspace) (ppSort xmobarPP) + , ppOrder = \(ws:_:t:_) -> [ ws, t] + } } `additionalKeys` [ ((modMask baseConfig .|. controlMask, xK_l), spawn "xscreensaver-command -lock")