summaryrefslogtreecommitdiffhomepage
path: root/Plugins/Monitors/Common.hs
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@ing.unitn.it>2007-07-24 11:27:01 +0200
committerAndrea Rossato <andrea.rossato@ing.unitn.it>2007-07-24 11:27:01 +0200
commita002121921c5c68956b3785c3d2a1f62f7f4752b (patch)
treea16cc5d0bead384cc43b59866c0603e92d233363 /Plugins/Monitors/Common.hs
parent2b6df4ff82e2dfb88f1dc781c31ed6d5b83c5d38 (diff)
downloadxmobar-a002121921c5c68956b3785c3d2a1f62f7f4752b.tar.gz
xmobar-a002121921c5c68956b3785c3d2a1f62f7f4752b.tar.bz2
Monitors.Common: parseString will not produce exceptions anymore
An empty string will be returned instead. darcs-hash:20070724092701-d6583-aa7c76ce3c38f93415c05b5afd86618b4aad6f71.gz
Diffstat (limited to 'Plugins/Monitors/Common.hs')
-rw-r--r--Plugins/Monitors/Common.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Plugins/Monitors/Common.hs b/Plugins/Monitors/Common.hs
index d2ae8c3..53374d2 100644
--- a/Plugins/Monitors/Common.hs
+++ b/Plugins/Monitors/Common.hs
@@ -253,7 +253,9 @@ floatToPercent n =
stringParser :: Pos -> B.ByteString -> String
stringParser (x,y) =
- flip (!!) x . map B.unpack . B.words . flip (!!) y . B.lines
+ tk x . words . tk y . lines . B.unpack
+ where tk i l | length l >= i = flip (!!) i $ l
+ | otherwise = []
setColor :: String -> Selector (Maybe String) -> Monitor String
setColor str s =