summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-02-08 00:34:25 +0000
committerjao <jao@gnu.org>2022-02-08 00:34:49 +0000
commite4ddbe7d649c618b2c78f33102c7f5855205f501 (patch)
treef50afe5dfeba2bcb445e88ee84fca23545ce000a
parente68c8f5ff1e3892add1bf4e240634ad33a154c84 (diff)
downloadxmobar-e4ddbe7d649c618b2c78f33102c7f5855205f501.tar.gz
xmobar-e4ddbe7d649c618b2c78f33102c7f5855205f501.tar.bz2
Linting
-rw-r--r--src/Xmobar/Text/Pango.hs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Xmobar/Text/Pango.hs b/src/Xmobar/Text/Pango.hs
index 30ec76f..609e3b1 100644
--- a/src/Xmobar/Text/Pango.hs
+++ b/src/Xmobar/Text/Pango.hs
@@ -35,13 +35,14 @@ withPangoColor (fg, bg) s =
printf fmt (xmlEscape fg) (xmlEscape bg) (xmlEscape s)
where fmt = "<span foreground=\"%s\" background=\"%s\">%s</span>"
+fixXft :: String -> String
+fixXft font = if "xft:" `isPrefixOf` font then drop 4 font else font
+
withPangoFont :: String -> String -> String
-withPangoFont font txt = printf fmt pfn (xmlEscape txt)
+withPangoFont font txt = printf fmt (fixXft font) (xmlEscape txt)
where fmt = "<span font=\"%s\">%s</span>"
- pfn = if "xft:" `isPrefixOf` font then drop 4 font else font
withPangoMarkup :: String -> String -> String -> String -> String
withPangoMarkup fg bg font txt =
- printf fmt pfn (xmlEscape fg) (xmlEscape bg) (xmlEscape txt)
- where pfn = if isPrefixOf "xft:" font then drop 4 font else font
- fmt = "<span font=\"%s\" foreground=\"%s\" background=\"%s\">%s</span>"
+ printf fmt (fixXft font) (xmlEscape fg) (xmlEscape bg) (xmlEscape txt)
+ where fmt = "<span font=\"%s\" foreground=\"%s\" background=\"%s\">%s</span>"