diff --git a/bin/xmonad.hs b/bin/xmonad.hs index 97140e8..81952e3 100644 --- a/bin/xmonad.hs +++ b/bin/xmonad.hs @@ -20,7 +20,10 @@ import Graphics.X11.Types import Graphics.X11.Xlib.Atom import Graphics.X11.Xlib.Extras -import RIO (async) +import RIO + ( async + , handleIO + ) import RIO.Process import qualified RIO.Text as T @@ -186,11 +189,7 @@ evalConf db@DBusState { dbSysClient = cl } = do $ fsDBusExporters fs startChildDaemons fs = do p <- proc "xmobar" [] (startProcess . setStdin createPipe) - -- (h, _, _, p) <- io $ createProcess $ (shell "xmobar") { std_in = CreatePipe } io $ hSetBuffering (getStdin p) LineBuffering - -- io $ case h of - -- Just h' -> hSetBuffering h' LineBuffering - -- Nothing -> return () ps <- catMaybes <$> mapM executeSometimes (fsDaemons fs) return $ ThreadState ps $ Just p startRemovableMon fs = void $ executeSometimes $ fsRemovableMon fs @@ -240,8 +239,11 @@ data ThreadState = ThreadState -- TODO shouldn't this be run by a signal handler? runCleanup :: ThreadState -> DBusState -> X () runCleanup ts db = io $ do + mapM_ stopNoWait $ tsXmobar ts mapM_ killHandle $ tsChildPIDs ts disconnectDBusX db + where + stopNoWait p = handleIO (\_ -> return ()) $ stopProcess p -------------------------------------------------------------------------------- -- | Startuphook configuration diff --git a/lib/Data/Internal/Dependency.hs b/lib/Data/Internal/Dependency.hs index e0b4a1c..4a5ef65 100644 --- a/lib/Data/Internal/Dependency.hs +++ b/lib/Data/Internal/Dependency.hs @@ -133,6 +133,7 @@ import System.Directory import System.Environment import System.IO.Error import System.Posix.Files +import System.Process.Typed (nullStream) import XMonad.Core (X, io) import XMonad.Internal.IO @@ -685,7 +686,7 @@ testSysDependency (AccessiblePath p r w) = io $ permMsg <$> getPermissionsSafe p shellTest :: FilePath -> [T.Text] -> T.Text -> FIO (Maybe Msg) shellTest cmd args msg = do - rc <- proc cmd (T.unpack <$> args) runProcess + rc <- proc cmd (T.unpack <$> args) (runProcess . setStdout nullStream) return $ case rc of ExitSuccess -> Nothing _ -> Just $ Msg LevelError msg diff --git a/package.yaml b/package.yaml index 4d2ae55..cbffa4e 100644 --- a/package.yaml +++ b/package.yaml @@ -41,6 +41,7 @@ dependencies: - xml >= 1.3.14 - lifted-base >= 0.2.3.12 - utf8-string >= 1.0.2 + - typed-process >= 0.2.8.0 library: source-dirs: lib/