From 1fabce659f0e3cc31b4160b4ac35f07ffe4faf6d Mon Sep 17 00:00:00 2001 From: Mads Rolsdorph Date: Mon, 24 May 2021 19:45:31 +0200 Subject: [PATCH] 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. --- CHANGES.md | 2 ++ XMonad/Hooks/StatusBar/PP.hs | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 8100686a..a25c99a6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -117,6 +117,8 @@ `workspaceNamesPP`, `marshallPP` and/or `clickablePP` to compose intuitively. + - Added `xmobarFont` for selecting an xmobar font index + * `XMonad.Hooks.StatusBar` diff --git a/XMonad/Hooks/StatusBar/PP.hs b/XMonad/Hooks/StatusBar/PP.hs index b6e47b71..d3e20bdf 100644 --- a/XMonad/Hooks/StatusBar/PP.hs +++ b/XMonad/Hooks/StatusBar/PP.hs @@ -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 ("") "" + -- | Use xmobar escape codes to output a string with given foreground -- and background colors. xmobarColor :: String -- ^ foreground color: a color name, or #rrggbb format