diff --git a/nix/configurations/vanadium/home/xmonad/xmonad.hs b/nix/configurations/vanadium/home/xmonad/xmonad.hs index 76fe99af..8a0e721c 100644 --- a/nix/configurations/vanadium/home/xmonad/xmonad.hs +++ b/nix/configurations/vanadium/home/xmonad/xmonad.hs @@ -27,6 +27,7 @@ import XMonad.Util.NamedScratchpad import XMonad.Util.SpawnOnce import XMonad.Layout.Magnifier +import Data.Function import Data.Char.Greek import Data.Ratio import Data.Semigroup @@ -332,17 +333,31 @@ buttomRightFloat = W.RationalRect (1%2) (1%2) (1%2) (1%2) xmobarConfig :: StatusBarConfig xmobarConfig = statusBarProp "xmobar -x 0" myPrettyPrinter where - windowCount :: X Int - windowCount = gets $ length . W.integrate' . W.stack . W.workspace . W.current . windowset + mkPpCurrent :: X (String -> String) + mkPpCurrent = do + windowCount <- gets $ length . W.integrate' . W.stack . W.workspace . W.current . windowset + pure $ \wid -> + wid <> (if windowCount > 1 then ":" <> show windowCount else mempty) + & xmobarColor "#000000" "#ffffff" . wrap " " " " + + mkPpHidden :: X (String -> String) + mkPpHidden = do + m <- gets $ M.fromList . map (\x -> (W.tag x, length . W.integrate' . W.stack $ x)) . W.hidden . windowset + pure $ \wid -> + let windowCount = m M.! wid + in wid <> (if windowCount > 1 then ":" <> show windowCount else mempty) + & xmobarColor "#ffffff" "" myPrettyPrinter :: X PP myPrettyPrinter = do - wCount <- windowCount + myPpCurrent <- mkPpCurrent + myPpHidden <- mkPpHidden pure $ filterOutWsPP [scratchpadWorkspaceTag] $ def - { ppCurrent = xmobarColor "#000000" "#ffffff" . wrap " " " " . ( <> ":" <> show wCount) + { ppCurrent = myPpCurrent , ppHiddenNoWindows = xmobarColor "#9c9c9c" "" . const "⋅" + , ppHidden = myPpHidden , ppSep = " | " }