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