diff --git a/bin/xmobar.hs b/bin/xmobar.hs index 936a01c..026d474 100644 --- a/bin/xmobar.hs +++ b/bin/xmobar.hs @@ -46,7 +46,7 @@ main = getArgs >>= parse parse :: [String] -> IO () parse [] = run parse ["--deps"] = withCache printDeps -parse ["--test"] = void $ withCache . evalConfig =<< connectDBus +parse ["--test"] = withCache $ withDBus_ evalConfig parse _ = usage run :: IO () @@ -66,11 +66,13 @@ evalConfig db = do return $ config bf ifs ios cs d printDeps :: FIO () -printDeps = do - db <- io connectDBus - let ps = sort $ nub $ fmap showFulfillment $ concatMap dumpFeature $ allFeatures db - io $ mapM_ (putStrLn . T.unpack) ps - io $ disconnectDBus db +printDeps = withDBus_ $ \db -> + mapM_ (liftIO . putStrLn . T.unpack) $ + sort $ + nub $ + fmap showFulfillment $ + concatMap dumpFeature $ + allFeatures db usage :: IO () usage =