diff options
author | gwern0 <gwern0@gmail.com> | 2007-10-24 02:16:28 +0200 |
---|---|---|
committer | gwern0 <gwern0@gmail.com> | 2007-10-24 02:16:28 +0200 |
commit | 4984acd0120116b4c0d9199041abfc5c213fcdab (patch) | |
tree | 1e6497109b6d22036e917ef222a5d31f8e6e0cb4 | |
parent | ee0a58ea0a471eb423a96e1778832f35b5bff43f (diff) | |
download | XMonadContrib-4984acd0120116b4c0d9199041abfc5c213fcdab.tar.gz XMonadContrib-4984acd0120116b4c0d9199041abfc5c213fcdab.tar.xz XMonadContrib-4984acd0120116b4c0d9199041abfc5c213fcdab.zip |
Run.hs: +my suggested runInTerm general function
darcs-hash:20071024001628-f7719-f20250b704f106adbf77f8a16dc1948781dc882c.gz
-rw-r--r-- | Run.hs | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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") |