diff options
author | slotThe <soliditsallgood@tuta.io> | 2020-01-09 15:54:47 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2020-01-16 15:05:22 +0000 |
commit | 1f1f0bd8b811740c84215f9ed4fa5ebd8309a990 (patch) | |
tree | 998ac613e08a115bfcceb7e1d93388a028980e6e /src/Xmobar/Plugins/Monitors/Common | |
parent | 36c69246f1a19af2a0713a8d8c7ab59ad108736f (diff) | |
download | xmobar-1f1f0bd8b811740c84215f9ed4fa5ebd8309a990.tar.gz xmobar-1f1f0bd8b811740c84215f9ed4fa5ebd8309a990.tar.bz2 |
Use a single Manager across the whole application
Diffstat (limited to 'src/Xmobar/Plugins/Monitors/Common')
-rw-r--r-- | src/Xmobar/Plugins/Monitors/Common/Types.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Xmobar/Plugins/Monitors/Common/Types.hs b/src/Xmobar/Plugins/Monitors/Common/Types.hs index c36a562..8662ba3 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 Data.IORef (IORef, modifyIORef, newIORef, readIORef) +import Control.Monad.Reader (ReaderT, ask, liftIO) +import Network.HTTP.Conduit (Manager, newManager, tlsManagerSettings) type Monitor a = ReaderT MConfig IO a @@ -55,6 +56,7 @@ data MConfig = , naString :: IORef String , maxTotalWidth :: IORef Int , maxTotalWidthEllipsis :: IORef String + , manager :: IORef Manager } -- | from 'http:\/\/www.haskell.org\/hawiki\/MonadState' @@ -102,7 +104,8 @@ mkMConfig tmpl exprts = na <- newIORef "N/A" mt <- newIORef 0 mtel <- newIORef "" - return $ MC nc l lc h hc t e p d mn mx mel pc pr bb bf bw up na mt mtel + man <- newIORef =<< newManager tlsManagerSettings + return $ MC nc l lc h hc t e p d mn mx mel pc pr bb bf bw up na mt mtel man data Opts = HighColor String | NormalColor String |