summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins
diff options
context:
space:
mode:
authorTomas Janousek <tomi@nomi.cz>2013-02-23 15:05:26 +0100
committerTomas Janousek <tomi@nomi.cz>2013-02-23 15:05:26 +0100
commit4a2df063a22228274fca1bee69fa73989995be47 (patch)
treed59a33e0b4c1d66070cf3b596e9ffc9976111630 /src/Plugins
parent9bd59a251b768f87197f9f1a0618784b485353a7 (diff)
downloadxmobar-4a2df063a22228274fca1bee69fa73989995be47.tar.gz
xmobar-4a2df063a22228274fca1bee69fa73989995be47.tar.bz2
Allow icons in monitor templates
Diffstat (limited to 'src/Plugins')
-rw-r--r--src/Plugins/Monitors/Common.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Plugins/Monitors/Common.hs b/src/Plugins/Monitors/Common.hs
index 7fcab1f..0547311 100644
--- a/src/Plugins/Monitors/Common.hs
+++ b/src/Plugins/Monitors/Common.hs
@@ -265,7 +265,7 @@ templateStringParser =
}
where
nonPlaceHolder = liftM concat . many $
- many1 (noneOf "<") <|> colorSpec
+ many1 (noneOf "<") <|> colorSpec <|> iconSpec
-- | Recognizes color specification and returns it unchanged
colorSpec :: Parser String
@@ -275,6 +275,12 @@ colorSpec = try (string "</fc>") <|> try (
char '>'
return $ "<fc=" ++ s ++ ">")
+-- | Recognizes icon specification and returns it unchanged
+iconSpec :: Parser String
+iconSpec = try (do string "<icon="
+ i <- manyTill (noneOf ">") (try (string "/>"))
+ return $ "<icon=" ++ i ++ "/>")
+
-- | Parses the command part of the template string
templateCommandParser :: Parser String
templateCommandParser =