summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Config/Parse.hs
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-09-30 06:50:53 +0100
committerjao <jao@gnu.org>2022-09-30 06:50:53 +0100
commitef380c045957413948d390c152f6401869526285 (patch)
tree178db978e94bba8f67d68e63b90e286dedbc2074 /src/Xmobar/Config/Parse.hs
parente9a86329d40f82f7710ac5be294e908d221e00bc (diff)
downloadxmobar-ef380c045957413948d390c152f6401869526285.tar.gz
xmobar-ef380c045957413948d390c152f6401869526285.tar.bz2
Run.Parsers -> Config.Template
Diffstat (limited to 'src/Xmobar/Config/Parse.hs')
-rw-r--r--src/Xmobar/Config/Parse.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Xmobar/Config/Parse.hs b/src/Xmobar/Config/Parse.hs
index 16af3db..23de4db 100644
--- a/src/Xmobar/Config/Parse.hs
+++ b/src/Xmobar/Config/Parse.hs
@@ -19,7 +19,8 @@
module Xmobar.Config.Parse(readConfig
, parseConfig
, indexedFont
- , indexedOffset) where
+ , indexedOffset
+ , colorComponents) where
import Text.ParserCombinators.Parsec
import Text.ParserCombinators.Parsec.Number (int)
@@ -31,6 +32,14 @@ import Xmobar.Config.Types
import qualified System.IO as S (readFile)
+-- | Splits a colors string into its two components
+colorComponents :: Config -> String -> (String, String)
+colorComponents conf c =
+ case break (==',') c of
+ (f,',':b) -> (f, b)
+ (f, _) -> (f, bgColor conf)
+
+
stripComments :: String -> String
stripComments =
unlines . map (drop 5 . strip False . (replicate 5 ' '++)) . lines