Add xmobarFont

xmobar allows you to define a list of additional fonts (additionalFonts) and to use the fn tag to choose between them. xmobarFont is essentially the same as the xmobarColor function, but for fonts.
This commit is contained in:
Mads Rolsdorph 2021-05-24 19:45:31 +02:00
parent 147e83cbd0
commit 1fabce659f
2 changed files with 9 additions and 1 deletions

View File

@ -117,6 +117,8 @@
`workspaceNamesPP`, `marshallPP` and/or `clickablePP` to compose
intuitively.
- Added `xmobarFont` for selecting an xmobar font index
* `XMonad.Hooks.StatusBar`

View File

@ -36,7 +36,7 @@ module XMonad.Hooks.StatusBar.PP (
-- * Formatting utilities
wrap, pad, trim, shorten, shorten', shortenLeft, shortenLeft',
xmobarColor, xmobarAction, xmobarBorder,
xmobarColor, xmobarFont, xmobarAction, xmobarBorder,
xmobarRaw, xmobarStrip, xmobarStripTags,
dzenColor, dzenEscape, dzenStrip, filterOutWsPP,
@ -286,6 +286,12 @@ dzenStrip = strip [] where
| otherwise = let (good,x') = span (/= '^') x
in strip (keep ++ good) x'
-- | Use xmobar escape codes to output a string with the font at the given index
xmobarFont :: Int -- ^ index: index of the font to use (0: standard font)
-> String -- ^ output string
-> String
xmobarFont index = wrap ("<fn=" ++ show index ++ ">") "</fn>"
-- | Use xmobar escape codes to output a string with given foreground
-- and background colors.
xmobarColor :: String -- ^ foreground color: a color name, or #rrggbb format