diff options
Diffstat (limited to 'src/Xmobar/Plugins/Monitors')
-rw-r--r-- | src/Xmobar/Plugins/Monitors/Common/Run.hs | 14 | ||||
-rw-r--r-- | src/Xmobar/Plugins/Monitors/Common/Types.hs | 5 | ||||
-rw-r--r-- | src/Xmobar/Plugins/Monitors/Cpu.hs | 6 |
3 files changed, 9 insertions, 16 deletions
diff --git a/src/Xmobar/Plugins/Monitors/Common/Run.hs b/src/Xmobar/Plugins/Monitors/Common/Run.hs index 9b0c1b7..076ac07 100644 --- a/src/Xmobar/Plugins/Monitors/Common/Run.hs +++ b/src/Xmobar/Plugins/Monitors/Common/Run.hs @@ -24,7 +24,7 @@ module Xmobar.Plugins.Monitors.Common.Run ( runM , getArgvs , doArgs , computePureConfig - , commonOptions + , pluginOptions ) where import Control.Exception (SomeException,handle) @@ -35,10 +35,8 @@ import System.Console.GetOpt import Xmobar.Plugins.Monitors.Common.Types import Xmobar.Run.Exec (doEveryTenthSeconds) -commonOptions = options - -options :: [OptDescr Opts] -options = +pluginOptions :: [OptDescr Opts] +pluginOptions = [ Option ['H'] ["High"] (ReqArg High "number") "The high threshold" , Option ['L'] ["Low"] (ReqArg Low "number") "The low threshold" @@ -66,7 +64,7 @@ options = -- | Get all argument values out of a list of arguments. getArgvs :: [String] -> [String] getArgvs args = - case getOpt Permute options args of + case getOpt Permute pluginOptions args of (_, n, [] ) -> n (_, _, errs) -> errs @@ -77,7 +75,7 @@ doArgs :: [String] -> ([String] -> Monitor Bool) -> Monitor String doArgs args action detect = - case getOpt Permute options args of + case getOpt Permute pluginOptions args of (o, n, []) -> do doConfigOptions o ready <- detect n if ready @@ -158,6 +156,6 @@ getMConfig args mconfig = do runReaderT (updateOptions args >> ask) config updateOptions :: [String] -> Monitor () -updateOptions args= case getOpt Permute options args of +updateOptions args= case getOpt Permute pluginOptions args of (o, _, []) -> doConfigOptions o _ -> return () diff --git a/src/Xmobar/Plugins/Monitors/Common/Types.hs b/src/Xmobar/Plugins/Monitors/Common/Types.hs index e8e9bfd..f1d85c9 100644 --- a/src/Xmobar/Plugins/Monitors/Common/Types.hs +++ b/src/Xmobar/Plugins/Monitors/Common/Types.hs @@ -22,7 +22,6 @@ module Xmobar.Plugins.Monitors.Common.Types ( Monitor , Opts (..) , Selector , setConfigValue - , getConfigValue , mkMConfig , io , PureConfig (..) @@ -135,10 +134,6 @@ sel s = do hs <- ask liftIO $ readIORef (s hs) -pmods :: PureConfig -> PSelector a -> (a -> a) -> a -pmods config value f = let val = value config - in f val - mods :: Selector a -> (a -> a) -> Monitor () mods s m = do v <- ask diff --git a/src/Xmobar/Plugins/Monitors/Cpu.hs b/src/Xmobar/Plugins/Monitors/Cpu.hs index 02d2949..82940b0 100644 --- a/src/Xmobar/Plugins/Monitors/Cpu.hs +++ b/src/Xmobar/Plugins/Monitors/Cpu.hs @@ -114,11 +114,11 @@ data CpuData = CpuData { } convertToCpuData :: [Float] -> CpuData -convertToCpuData (u:n:s:id:iw:_) = CpuData { +convertToCpuData (u:n:s:ie:iw:_) = CpuData { cpuUser = u, cpuNice = n, cpuSystem = s, - cpuIdle = id, + cpuIdle = ie, cpuIowait = iw, cpuTotal = sum [u,n,s] } @@ -212,7 +212,7 @@ getArguments cpuArgs = do cpuParams <- computePureConfig cpuArgs cpuConfig cpuInputTemplate <- runTemplateParser cpuParams cpuAllTemplate <- runExportParser (pExport cpuParams) - nonOptions <- case getOpt Permute commonOptions cpuArgs of + nonOptions <- case getOpt Permute pluginOptions cpuArgs of (_, n, []) -> pure n (_,_,errs) -> error $ "getArguments: " <> show errs cpuOpts <- case getOpt Permute options nonOptions of |