Compare commits
No commits in common. "8c20a4668d812aeb7834003301e3c8379c6f0f69" and "a997cac7a38874ea9ae74040062bd6baf87eb7ef" have entirely different histories.
8c20a4668d
...
a997cac7a3
|
@ -46,12 +46,14 @@ main = getArgs >>= parse
|
|||
parse :: [String] -> IO ()
|
||||
parse [] = run
|
||||
parse ["--deps"] = withCache printDeps
|
||||
parse ["--test"] = withCache $ withDBus_ evalConfig
|
||||
parse ["--test"] = void $ withCache . evalConfig =<< connectDBus
|
||||
parse _ = usage
|
||||
|
||||
run :: IO ()
|
||||
run = withCache $ withDBus_ $ \db -> do
|
||||
run = withCache $ do
|
||||
db <- connectDBus
|
||||
c <- evalConfig db
|
||||
disconnectDBus db
|
||||
liftIO $ do
|
||||
-- this is needed to see any printed messages
|
||||
hFlush stdout
|
||||
|
@ -66,13 +68,11 @@ evalConfig db = do
|
|||
return $ config bf ifs ios cs d
|
||||
|
||||
printDeps :: FIO ()
|
||||
printDeps = withDBus_ $ \db ->
|
||||
mapM_ (liftIO . putStrLn . T.unpack) $
|
||||
sort $
|
||||
nub $
|
||||
fmap showFulfillment $
|
||||
concatMap dumpFeature $
|
||||
allFeatures db
|
||||
printDeps = do
|
||||
db <- io connectDBus
|
||||
let ps = sort $ nub $ fmap showFulfillment $ concatMap dumpFeature $ allFeatures db
|
||||
io $ mapM_ (putStrLn . T.unpack) ps
|
||||
io $ disconnectDBus db
|
||||
|
||||
usage :: IO ()
|
||||
usage =
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
module XMonad.Internal.DBus.Control
|
||||
( Client
|
||||
, DBusState (..)
|
||||
, withDBus
|
||||
, withDBus_
|
||||
, connectDBus
|
||||
, connectDBusX
|
||||
, disconnectDBus
|
||||
|
@ -36,12 +34,6 @@ data DBusState = DBusState
|
|||
, dbSysClient :: Maybe SysClient
|
||||
}
|
||||
|
||||
withDBus_ :: MonadUnliftIO m => (DBusState -> m a) -> m ()
|
||||
withDBus_ = void . withDBus
|
||||
|
||||
withDBus :: MonadUnliftIO m => (DBusState -> m a) -> m a
|
||||
withDBus = bracket connectDBus disconnectDBus
|
||||
|
||||
-- | Connect to the DBus
|
||||
connectDBus :: MonadUnliftIO m => m DBusState
|
||||
connectDBus = do
|
||||
|
|
Loading…
Reference in New Issue