69 lines
2.1 KiB
Haskell
69 lines
2.1 KiB
Haskell
{-# LANGUAGE FlexibleContexts #-}
|
|
|
|
module StatusBar (
|
|
StatusBar.modify
|
|
) where
|
|
|
|
import Data.List
|
|
import Data.Monoid
|
|
import Nord as N
|
|
import XMonad.Core
|
|
import XMonad.Hooks.DynamicBars (dynStatusBarStartup,dynStatusBarEventHook,multiPP)
|
|
import XMonad.Hooks.DynamicLog
|
|
import XMonad.ManageHook
|
|
import XMonad.Util.Run
|
|
|
|
-- Type constructors
|
|
import GHC.IO.Handle (Handle)
|
|
|
|
modify :: XConfig l -> XConfig l
|
|
modify conf = conf
|
|
{ startupHook = do
|
|
startupHook conf
|
|
dynStatusBarStartup runXmobar killXmobar
|
|
, handleEventHook = handleEventHook conf <+> dynStatusBarEventHook runXmobar killXmobar
|
|
, logHook = do
|
|
logHook conf
|
|
multiPP currentPP otherPP
|
|
}
|
|
|
|
runXmobar :: ScreenId -> IO Handle
|
|
runXmobar (S id) = spawnPipe
|
|
$ "/run/current-system/sw/bin/xmobar --screen="
|
|
<> show id
|
|
<> " /home/eeva/.xmonad/xmobarrc"
|
|
|
|
killXmobar :: IO ()
|
|
-- killXmobar = spawn "/run/current-system/sw/bin/pkill xmobar"
|
|
killXmobar = return ()
|
|
|
|
otherPP = currentPP
|
|
{ ppCurrent = xmobarColor N.foreground N.background
|
|
, ppVisible = xmobarColor N.foreground N.background
|
|
, ppHidden = xmobarColor N.foreground N.background
|
|
, ppHiddenNoWindows = xmobarColor N.backgroundhl N.background
|
|
}
|
|
|
|
currentPP = def
|
|
{ ppCurrent = xmobarColor' N.orange
|
|
, ppVisible = xmobarColor' N.yellow -- other screen
|
|
, ppHidden = xmobarColor' N.foreground -- other workspaces with windows
|
|
, ppHiddenNoWindows = xmobarColor' N.foregroundll -- other workspaces
|
|
, ppSep = " "
|
|
, ppWsSep = " "
|
|
, ppLayout = printLayout
|
|
, ppTitle = printTitle
|
|
}
|
|
where xmobarColor' fg = xmobarColor fg S.base03
|
|
|
|
printLayout s | "Mirror ResizableTall" `isSuffixOf` s = "[ — ]"
|
|
printLayout s | "ResizableTall" `isSuffixOf` s = "[ | ]"
|
|
printLayout "Full" = "[ F ]"
|
|
printLayout l = "[" ++ l ++ "]"
|
|
|
|
printTitle t = let t' = shorten 120 t
|
|
in xmobarColor' S.foregroundll "« "
|
|
++ xmobarColor' S.foregroundhl t'
|
|
++ xmobarColor' S.foregroundll " »"
|
|
|
|
|