mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
vanadium/xmonad: show current window count in pp
This commit is contained in:
parent
60bfd4f5c9
commit
b8f78260b3
1 changed files with 19 additions and 4 deletions
|
|
@ -27,6 +27,7 @@ import XMonad.Util.NamedScratchpad
|
||||||
import XMonad.Util.SpawnOnce
|
import XMonad.Util.SpawnOnce
|
||||||
import XMonad.Layout.Magnifier
|
import XMonad.Layout.Magnifier
|
||||||
|
|
||||||
|
import Data.Function
|
||||||
import Data.Char.Greek
|
import Data.Char.Greek
|
||||||
import Data.Ratio
|
import Data.Ratio
|
||||||
import Data.Semigroup
|
import Data.Semigroup
|
||||||
|
|
@ -332,17 +333,31 @@ buttomRightFloat = W.RationalRect (1%2) (1%2) (1%2) (1%2)
|
||||||
xmobarConfig :: StatusBarConfig
|
xmobarConfig :: StatusBarConfig
|
||||||
xmobarConfig = statusBarProp "xmobar -x 0" myPrettyPrinter
|
xmobarConfig = statusBarProp "xmobar -x 0" myPrettyPrinter
|
||||||
where
|
where
|
||||||
windowCount :: X Int
|
mkPpCurrent :: X (String -> String)
|
||||||
windowCount = gets $ length . W.integrate' . W.stack . W.workspace . W.current . windowset
|
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 :: X PP
|
||||||
myPrettyPrinter = do
|
myPrettyPrinter = do
|
||||||
wCount <- windowCount
|
myPpCurrent <- mkPpCurrent
|
||||||
|
myPpHidden <- mkPpHidden
|
||||||
pure
|
pure
|
||||||
$ filterOutWsPP [scratchpadWorkspaceTag]
|
$ filterOutWsPP [scratchpadWorkspaceTag]
|
||||||
$ def
|
$ def
|
||||||
{ ppCurrent = xmobarColor "#000000" "#ffffff" . wrap " " " " . ( <> ":" <> show wCount)
|
{ ppCurrent = myPpCurrent
|
||||||
, ppHiddenNoWindows = xmobarColor "#9c9c9c" "" . const "⋅"
|
, ppHiddenNoWindows = xmobarColor "#9c9c9c" "" . const "⋅"
|
||||||
|
, ppHidden = myPpHidden
|
||||||
, ppSep = " | "
|
, ppSep = " | "
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue