From c36a63e251ab808f871566d840781d2599c477a4 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Fri, 30 Dec 2022 17:02:23 -0500 Subject: [PATCH] ENH generalize vpn plugin --- lib/Xmobar/Plugins/VPN.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Xmobar/Plugins/VPN.hs b/lib/Xmobar/Plugins/VPN.hs index 3ccf837..309938e 100644 --- a/lib/Xmobar/Plugins/VPN.hs +++ b/lib/Xmobar/Plugins/VPN.hs @@ -53,12 +53,12 @@ type VPNState = S.Set ObjectPath type MutableVPNState = MVar VPNState -initState :: SysClient -> IO MutableVPNState +initState :: MonadUnliftIO m => SysClient -> m MutableVPNState initState client = do ot <- getVPNObjectTree client newMVar $ findTunnels ot -readState :: MutableVPNState -> IO Bool +readState :: MonadUnliftIO m => MutableVPNState -> m Bool readState = fmap (not . null) . readMVar updateState @@ -72,7 +72,7 @@ updateState f state op = modifyMVar_ state $ return . f op -------------------------------------------------------------------------------- -- Tunnel Device Detection -getVPNObjectTree :: SysClient -> IO ObjectTree +getVPNObjectTree :: MonadUnliftIO m => SysClient -> m ObjectTree getVPNObjectTree sys = callGetManagedObjects sys vpnBus vpnPath findTunnels :: ObjectTree -> VPNState