mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-13 11:16:01 -07:00
Run.hs: +my suggested runInTerm general function
This commit is contained in:
7
Run.hs
7
Run.hs
@@ -22,6 +22,7 @@ module XMonadContrib.Run (
|
|||||||
runProcessWithInputAndWait,
|
runProcessWithInputAndWait,
|
||||||
safeSpawn,
|
safeSpawn,
|
||||||
unsafeSpawn,
|
unsafeSpawn,
|
||||||
|
runInTerm,
|
||||||
runInXTerm,
|
runInXTerm,
|
||||||
seconds
|
seconds
|
||||||
) where
|
) where
|
||||||
@@ -105,6 +106,12 @@ safeSpawn prog arg = io (try (forkProcess $ executeFile prog True [arg] Nothing)
|
|||||||
unsafeSpawn :: String -> X ()
|
unsafeSpawn :: String -> X ()
|
||||||
unsafeSpawn = spawn
|
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 :: String -> X ()
|
||||||
runInXTerm com = do
|
runInXTerm com = do
|
||||||
c <- io $ catch (getEnv "XTERMCMD") (const $ return "xterm")
|
c <- io $ catch (getEnv "XTERMCMD") (const $ return "xterm")
|
||||||
|
Reference in New Issue
Block a user