summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Plugins/Monitors
diff options
context:
space:
mode:
Diffstat (limited to 'src/Xmobar/Plugins/Monitors')
-rw-r--r--src/Xmobar/Plugins/Monitors/Common/Run.hs8
-rw-r--r--src/Xmobar/Plugins/Monitors/Common/Types.hs5
-rw-r--r--src/Xmobar/Plugins/Monitors/CoreTemp.hs3
-rw-r--r--src/Xmobar/Plugins/Monitors/UVMeter.hs1
-rw-r--r--src/Xmobar/Plugins/Monitors/Weather.hs4
5 files changed, 17 insertions, 4 deletions
diff --git a/src/Xmobar/Plugins/Monitors/Common/Run.hs b/src/Xmobar/Plugins/Monitors/Common/Run.hs
index 74a7695..a73a6fb 100644
--- a/src/Xmobar/Plugins/Monitors/Common/Run.hs
+++ b/src/Xmobar/Plugins/Monitors/Common/Run.hs
@@ -19,6 +19,7 @@ module Xmobar.Plugins.Monitors.Common.Run ( runM
, runMD
, runMB
, runMBD
+ , getArgvs
) where
import Control.Exception (SomeException,handle)
@@ -55,6 +56,13 @@ options =
, Option "E" ["maxtwidthellipsis"] (ReqArg MaxTotalWidthEllipsis "Maximum total width ellipsis") "Ellipsis to be added to the total text when it has reached its max width."
]
+-- | Get all argument values out of a list of arguments.
+getArgvs :: [String] -> [String]
+getArgvs args =
+ case getOpt Permute options args of
+ (_, n, [] ) -> n
+ (_, _, errs) -> errs
+
doArgs :: [String]
-> ([String] -> Monitor String)
-> ([String] -> Monitor Bool)
diff --git a/src/Xmobar/Plugins/Monitors/Common/Types.hs b/src/Xmobar/Plugins/Monitors/Common/Types.hs
index c36a562..fc71da3 100644
--- a/src/Xmobar/Plugins/Monitors/Common/Types.hs
+++ b/src/Xmobar/Plugins/Monitors/Common/Types.hs
@@ -25,8 +25,9 @@ module Xmobar.Plugins.Monitors.Common.Types ( Monitor
, io
) where
-import Data.IORef
-import Control.Monad.Reader
+import Control.Monad.Reader (ReaderT, ask, liftIO)
+import Data.IORef (IORef, modifyIORef, newIORef, readIORef)
+
type Monitor a = ReaderT MConfig IO a
diff --git a/src/Xmobar/Plugins/Monitors/CoreTemp.hs b/src/Xmobar/Plugins/Monitors/CoreTemp.hs
index 3e462ce..1a75988 100644
--- a/src/Xmobar/Plugins/Monitors/CoreTemp.hs
+++ b/src/Xmobar/Plugins/Monitors/CoreTemp.hs
@@ -25,8 +25,7 @@ import Data.Char (isDigit)
coreTempConfig :: IO MConfig
coreTempConfig = mkMConfig
"Temp: <core0>C" -- template
- (map ((++) "core" . show) [0 :: Int ..]) -- available
- -- replacements
+ (map ((++) "core" . show) [0 :: Int ..]) -- available replacements
-- |
-- Function retrieves monitor string holding the core temperature
diff --git a/src/Xmobar/Plugins/Monitors/UVMeter.hs b/src/Xmobar/Plugins/Monitors/UVMeter.hs
index 079177f..839daed 100644
--- a/src/Xmobar/Plugins/Monitors/UVMeter.hs
+++ b/src/Xmobar/Plugins/Monitors/UVMeter.hs
@@ -22,6 +22,7 @@ import Network.HTTP.Conduit
(parseRequest, newManager, tlsManagerSettings, httpLbs,
responseBody)
import Data.ByteString.Lazy.Char8 as B
+import Data.IORef (newIORef, readIORef)
import Text.Read (readMaybe)
import Text.Parsec
import Text.Parsec.String
diff --git a/src/Xmobar/Plugins/Monitors/Weather.hs b/src/Xmobar/Plugins/Monitors/Weather.hs
index 07d8cc4..f448b11 100644
--- a/src/Xmobar/Plugins/Monitors/Weather.hs
+++ b/src/Xmobar/Plugins/Monitors/Weather.hs
@@ -19,6 +19,10 @@ import Xmobar.Plugins.Monitors.Common
import qualified Control.Exception as CE
+import Control.Monad.Reader (asks)
+import qualified Data.ByteString.Lazy.Char8 as B
+import Data.Char (toLower)
+import Data.IORef (newIORef, readIORef)
import Network.HTTP.Conduit
import Network.HTTP.Types.Status
import Network.HTTP.Types.Method