2017-12-12 00:48:56 +01:00
|
|
|
{-# LANGUAGE FlexibleContexts #-}
|
|
|
|
|
|
|
|
module StatusBar (
|
|
|
|
StatusBar.modify
|
|
|
|
) where
|
|
|
|
|
|
|
|
import Data.List
|
|
|
|
import Data.Monoid
|
2020-03-08 08:51:14 +01:00
|
|
|
import Nord as N
|
2017-12-12 00:48:56 +01:00
|
|
|
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
|
2020-03-08 08:51:14 +01:00
|
|
|
{ ppCurrent = xmobarColor N.foreground N.background
|
|
|
|
, ppVisible = xmobarColor N.foreground N.background
|
|
|
|
, ppHidden = xmobarColor N.foreground N.background
|
|
|
|
, ppHiddenNoWindows = xmobarColor N.backgroundhl N.background
|
2017-12-12 00:48:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
currentPP = def
|
2020-03-08 08:51:14 +01:00
|
|
|
{ ppCurrent = xmobarColor' N.orange
|
|
|
|
, ppVisible = xmobarColor' N.yellow -- other screen
|
|
|
|
, ppHidden = xmobarColor' N.foreground -- other workspaces with windows
|
|
|
|
, ppHiddenNoWindows = xmobarColor' N.foregroundll -- other workspaces
|
2017-12-12 00:48:56 +01:00
|
|
|
, 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 " »"
|
|
|
|
|
|
|
|
|