diff --git a/lib/Data/Internal/DBus.hs b/lib/Data/Internal/DBus.hs index baf64a0..c18bc8d 100644 --- a/lib/Data/Internal/DBus.hs +++ b/lib/Data/Internal/DBus.hs @@ -278,14 +278,21 @@ omInterfacesRemoved :: MemberName omInterfacesRemoved = memberName_ "InterfacesRemoved" callGetManagedObjects - :: (MonadUnliftIO m, SafeClient c) + :: (MonadReader env m, HasLogFunc env, MonadUnliftIO m, SafeClient c) => c -> BusName -> ObjectPath -> m ObjectTree -callGetManagedObjects cl bus path = - either (const M.empty) (fromMaybe M.empty . fromSingletonVariant) - <$> callMethod cl bus path omInterface getManagedObjects +callGetManagedObjects cl bus path = do + res <- callMethod cl bus path omInterface getManagedObjects + case res of + Left err -> do + logError $ Utf8Builder $ encodeUtf8Builder err + return M.empty + Right v -> return $ fromMaybe M.empty $ fromSingletonVariant v + +-- either (const M.empty) (fromMaybe M.empty . fromSingletonVariant) +-- <$> addInterfaceChangedListener :: (MonadReader env m, HasLogFunc env, MonadUnliftIO m, SafeClient c) diff --git a/lib/Xmobar/Plugins/Bluetooth.hs b/lib/Xmobar/Plugins/Bluetooth.hs index 4173ca8..58536c0 100644 --- a/lib/Xmobar/Plugins/Bluetooth.hs +++ b/lib/Xmobar/Plugins/Bluetooth.hs @@ -164,7 +164,10 @@ adaptorHasDevice adaptor device = case splitPathNoRoot device of splitPathNoRoot :: ObjectPath -> [FilePath] splitPathNoRoot = dropWhile (== "/") . splitDirectories . formatObjectPath -getBtObjectTree :: MonadUnliftIO m => SysClient -> m ObjectTree +getBtObjectTree + :: (MonadReader env m, HasLogFunc env, MonadUnliftIO m) + => SysClient + -> m ObjectTree getBtObjectTree sys = callGetManagedObjects sys btBus btOMPath btOMPath :: ObjectPath diff --git a/lib/Xmobar/Plugins/VPN.hs b/lib/Xmobar/Plugins/VPN.hs index 5c50618..0de5391 100644 --- a/lib/Xmobar/Plugins/VPN.hs +++ b/lib/Xmobar/Plugins/VPN.hs @@ -52,7 +52,10 @@ type VPNState = S.Set ObjectPath type MutableVPNState = MVar VPNState -initState :: MonadUnliftIO m => SysClient -> m MutableVPNState +initState + :: (MonadReader env m, HasLogFunc env, MonadUnliftIO m) + => SysClient + -> m MutableVPNState initState client = do ot <- getVPNObjectTree client newMVar $ findTunnels ot @@ -71,7 +74,10 @@ updateState f state op = modifyMVar_ state $ return . f op -------------------------------------------------------------------------------- -- Tunnel Device Detection -getVPNObjectTree :: MonadUnliftIO m => SysClient -> m ObjectTree +getVPNObjectTree + :: (MonadReader env m, HasLogFunc env, MonadUnliftIO m) + => SysClient + -> m ObjectTree getVPNObjectTree sys = callGetManagedObjects sys vpnBus vpnPath findTunnels :: ObjectTree -> VPNState