aboutsummaryrefslogtreecommitdiff
path: root/src/Rahm/Desktop/XMobarLog.hs
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2022-11-20 18:31:39 -0700
committerJosh Rahm <joshuarahm@gmail.com>2022-11-20 18:31:39 -0700
commita1636c65e05d02f7d4fc408137e1d37b412ce890 (patch)
tree21411c7c2e9a5c4be5755c63df886b375ba8d9ba /src/Rahm/Desktop/XMobarLog.hs
parent937252ba0b3375ee20598e364ca170e7c80f1a3a (diff)
downloadrde-a1636c65e05d02f7d4fc408137e1d37b412ce890.tar.gz
rde-a1636c65e05d02f7d4fc408137e1d37b412ce890.tar.bz2
rde-a1636c65e05d02f7d4fc408137e1d37b412ce890.zip
Add better theater reporting to xmobar
Diffstat (limited to 'src/Rahm/Desktop/XMobarLog.hs')
-rw-r--r--src/Rahm/Desktop/XMobarLog.hs27
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