From ee0a58ea0a471eb423a96e1778832f35b5bff43f Mon Sep 17 00:00:00 2001 From: gwern0 Date: Wed, 24 Oct 2007 02:13:41 +0200 Subject: Run.hs, SshPrompt.hs, ShellPrompt.hs: mv runInXTerm back into Run.hs per suggestions darcs-hash:20071024001341-f7719-6ea9cf7134f0300c53e85cddfff1e320039c115b.gz --- Run.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Run.hs') diff --git a/Run.hs b/Run.hs index 5d61110..c3ed501 100644 --- a/Run.hs +++ b/Run.hs @@ -22,10 +22,12 @@ module XMonadContrib.Run ( runProcessWithInputAndWait, safeSpawn, unsafeSpawn, + runInXTerm, seconds ) where import Control.Monad.State (Monad((>>), return), when) +import System.Environment (getEnv) import System.Posix.Process (createSession, forkProcess, executeFile, getProcessStatus) import Control.Concurrent (threadDelay) @@ -102,3 +104,8 @@ safeSpawn :: FilePath -> String -> X () safeSpawn prog arg = io (try (forkProcess $ executeFile prog True [arg] Nothing) >> return ()) unsafeSpawn :: String -> X () unsafeSpawn = spawn + +runInXTerm :: String -> X () +runInXTerm com = do + c <- io $ catch (getEnv "XTERMCMD") (const $ return "xterm") + spawn ("exec " ++ c ++ " -e " ++ com) -- cgit v1.2.3