From 4984acd0120116b4c0d9199041abfc5c213fcdab Mon Sep 17 00:00:00 2001 From: gwern0 Date: Wed, 24 Oct 2007 02:16:28 +0200 Subject: Run.hs: +my suggested runInTerm general function darcs-hash:20071024001628-f7719-f20250b704f106adbf77f8a16dc1948781dc882c.gz --- Run.hs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Run.hs') diff --git a/Run.hs b/Run.hs index c3ed501..f7d134b 100644 --- a/Run.hs +++ b/Run.hs @@ -22,6 +22,7 @@ module XMonadContrib.Run ( runProcessWithInputAndWait, safeSpawn, unsafeSpawn, + runInTerm, runInXTerm, seconds ) where @@ -105,6 +106,12 @@ safeSpawn prog arg = io (try (forkProcess $ executeFile prog True [arg] Nothing) unsafeSpawn :: String -> X () unsafeSpawn = spawn +-- | Run a given program in a given X terminal emulator. This uses safeSpawn. +runInTerm :: String -> String -> X () +runInTerm term command = safeSpawn term ("-e " ++ command) + +-- | Runs a given program in XTerm, the X terminal emulator included by default in X.org installations. +-- The use of XTerm can be overridden in one's shell by setting $XTERMCMD to another shell's name. runInXTerm :: String -> X () runInXTerm com = do c <- io $ catch (getEnv "XTERMCMD") (const $ return "xterm") -- cgit v1.2.3