From 3891e8ca2804df0a69a4bccbceb99403c70fbfe6 Mon Sep 17 00:00:00 2001 From: slotThe Date: Mon, 14 Oct 2019 11:21:26 +0200 Subject: Add types for percentage based volume control --- src/Xmobar/Plugins/Monitors/Volume.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Xmobar/Plugins/Monitors/Volume.hs b/src/Xmobar/Plugins/Monitors/Volume.hs index 05c12d1..250918a 100644 --- a/src/Xmobar/Plugins/Monitors/Volume.hs +++ b/src/Xmobar/Plugins/Monitors/Volume.hs @@ -42,6 +42,8 @@ data VolumeOpts = VolumeOpts , highDbThresh :: Float , lowDbThresh :: Float , volumeIconPattern :: Maybe IconPattern + , lowVolThresh :: Maybe Float + , highVolThresh :: Maybe Float } defaultOpts :: VolumeOpts @@ -53,6 +55,8 @@ defaultOpts = VolumeOpts , highDbThresh = -5.0 , lowDbThresh = -30.0 , volumeIconPattern = Nothing + , lowVolThresh = Just 20 + , highVolThresh = Just 60 } options :: [OptDescr (VolumeOpts -> VolumeOpts)] @@ -65,6 +69,8 @@ options = , Option "c" ["offc"] (ReqArg (\x o -> o { offColor = Just x }) "") "" , Option "" ["volume-icon-pattern"] (ReqArg (\x o -> 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 }) "") "" ] parseOpts :: [String] -> IO VolumeOpts -- cgit v1.2.3