summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorslotThe <soliditsallgood@tuta.io>2019-10-14 12:21:16 +0200
committerslotThe <soliditsallgood@tuta.io>2019-10-14 12:55:22 +0200
commit01cc232d3e1fee19a93d054b69dbb8590059e813 (patch)
treeb63cbf7786a8d4ee17e5e64eba5421678acb588f
parent3891e8ca2804df0a69a4bccbceb99403c70fbfe6 (diff)
downloadxmobar-01cc232d3e1fee19a93d054b69dbb8590059e813.tar.gz
xmobar-01cc232d3e1fee19a93d054b69dbb8590059e813.tar.bz2
Add types for displaying a string based on volume percentage
-rw-r--r--src/Xmobar/Plugins/Monitors/Volume.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Xmobar/Plugins/Monitors/Volume.hs b/src/Xmobar/Plugins/Monitors/Volume.hs
index 250918a..fb158eb 100644
--- a/src/Xmobar/Plugins/Monitors/Volume.hs
+++ b/src/Xmobar/Plugins/Monitors/Volume.hs
@@ -44,6 +44,9 @@ data VolumeOpts = VolumeOpts
, volumeIconPattern :: Maybe IconPattern
, lowVolThresh :: Maybe Float
, highVolThresh :: Maybe Float
+ , lowString :: String
+ , mediumString :: String
+ , highString :: String
}
defaultOpts :: VolumeOpts
@@ -55,8 +58,11 @@ defaultOpts = VolumeOpts
, highDbThresh = -5.0
, lowDbThresh = -30.0
, volumeIconPattern = Nothing
- , lowVolThresh = Just 20
- , highVolThresh = Just 60
+ , lowVolThresh = Just 20.0
+ , highVolThresh = Just 60.0
+ , lowString = ""
+ , mediumString = ""
+ , highString = ""
}
options :: [OptDescr (VolumeOpts -> VolumeOpts)]
@@ -71,6 +77,9 @@ options =
o { volumeIconPattern = Just $ parseIconPattern x }) "") ""
, Option "L" ["lowv"] (ReqArg (\x o -> o { lowVolThresh = Just $ read x }) "") ""
, Option "H" ["highv"] (ReqArg (\x o -> o { highVolThresh = Just $ read x }) "") ""
+ , Option "l" ["lows"] (ReqArg (\x o -> o { lowString = x }) "") ""
+ , Option "m" ["mediums"] (ReqArg (\x o -> o { mediumString = x }) "") ""
+ , Option "h" ["highs"] (ReqArg (\x o -> o { highString = x }) "") ""
]
parseOpts :: [String] -> IO VolumeOpts