diff options
Diffstat (limited to 'src/Rahm/Desktop/XMobarLog.hs')
| -rw-r--r-- | src/Rahm/Desktop/XMobarLog.hs | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/Rahm/Desktop/XMobarLog.hs b/src/Rahm/Desktop/XMobarLog.hs index 9ea8bad..e419739 100644 --- a/src/Rahm/Desktop/XMobarLog.hs +++ b/src/Rahm/Desktop/XMobarLog.hs @@ -4,7 +4,7 @@ import Control.Arrow (second) import Control.Monad (forM_) import Control.Monad.Writer (tell, execWriter) import Data.List (sortBy) -import Data.Maybe (mapMaybe) +import Data.Maybe (mapMaybe, isJust) import Data.Ord (comparing) import Data.Char (isAsciiLower, isAsciiUpper, isDigit) import Rahm.Desktop.Layout.Draw (drawLayout) @@ -15,7 +15,7 @@ import XMonad (X) import Rahm.Desktop.Workspaces (getPopulatedWorkspaces, WorkspaceState(..)) import Text.Printf import Rahm.Desktop.Logger -import Rahm.Desktop.Theater (getCurrentTheaterName) +import Rahm.Desktop.Theater (getTheaters) import qualified XMonad as X import qualified Rahm.Desktop.StackSet as S @@ -42,7 +42,7 @@ xMobarLogHook (XMobarLog xmproc) = do (_, _, layoutXpm) <- drawLayout loglevel <- getLogLevel - currentTheater <- getCurrentTheaterName + theaters <- filter (\(j, _, _) -> isJust j) <$> getTheaters winset <- X.gets X.windowset title <- maybe (pure "") (fmap show . getName) . S.peek $ winset @@ -54,13 +54,22 @@ xMobarLogHook (XMobarLog xmproc) = do tell " " tell $ logLevelToXMobar loglevel - case currentTheater of - Just theater -> do - tell "<fn=1><fc=#ffffff>[" - tell theater - tell "] </fc></fn>" + forM_ theaters $ \theater -> case theater of + (Just n, _, True) -> do + tell "<fn=1><fc=#ffffff>" + tell n + tell " </fc></fn>" - Nothing -> tell " " + (Just n, _, False) -> do + tell "<fn=2><fc=#888888>" + tell n + tell " </fc></fn>" + + _ -> return () + + if not (null theaters) + then tell "| " + else return () forM_ wss $ \(t, ws) -> do case t of |