From c5f7a0ab918ee2e4296263b447157ea3bfcf180e Mon Sep 17 00:00:00 2001 From: Christian Thiemann Date: Fri, 12 Oct 2007 16:52:33 +0200 Subject: Move runXXX functions to one module This patch takes runProcessWithInput out of Dmenu, runProcessWithInputAndWait out of Dzen, and runInXTerm out of RunInXTerm and collects them in one central module called Run. This way, other modules may include Run instead of Dmenu to get what they want without giving the impression of making use of dmenu. darcs-hash:20071012145233-8602e-6f8fb66c62afecdbd52a6a9122b5ecb55fc7f8bc.gz --- Dzen.hs | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'Dzen.hs') diff --git a/Dzen.hs b/Dzen.hs index 12be81c..4e63bfb 100644 --- a/Dzen.hs +++ b/Dzen.hs @@ -14,38 +14,10 @@ module XMonadContrib.Dzen (dzen, dzenScreen) where -import System.Posix.Process (forkProcess, getProcessStatus, createSession) -import System.IO -import System.Process -import System.Exit -import Control.Concurrent (threadDelay) import Control.Monad.State - import qualified StackSet as W import XMonad - --- wait is in us -runProcessWithInputAndWait :: FilePath -> [String] -> String -> Int -> IO () -runProcessWithInputAndWait cmd args input timeout = do - pid <- forkProcess $ do - forkProcess $ do -- double fork it over to init - createSession - (pin, pout, perr, ph) <- runInteractiveProcess cmd args Nothing Nothing - hPutStr pin input - hFlush pin - threadDelay timeout - hClose pin - -- output <- hGetContents pout - -- when (output==output) $ return () - hClose pout - hClose perr - waitForProcess ph - return () - exitWith ExitSuccess - return () - getProcessStatus True False pid - return () - +import XMonadContrib.Run curScreen :: X ScreenId curScreen = (W.screen . W.current) `liftM` gets windowset -- cgit v1.2.3