aboutsummaryrefslogtreecommitdiffstats
path: root/RunInXTerm.hs
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@unibz.it>2007-08-07 12:16:03 +0200
committerAndrea Rossato <andrea.rossato@unibz.it>2007-08-07 12:16:03 +0200
commitcc627f41303a7b2979910a94ee90aa9e96367538 (patch)
tree946a438b0e42fc2d6dc4409a381011863b136270 /RunInXTerm.hs
parent8dbe4a1e7b72fb5bfc91e24d355de7216d5d3ef3 (diff)
downloadXMonadContrib-cc627f41303a7b2979910a94ee90aa9e96367538.tar.gz
XMonadContrib-cc627f41303a7b2979910a94ee90aa9e96367538.tar.xz
XMonadContrib-cc627f41303a7b2979910a94ee90aa9e96367538.zip
RunInXTerm: a simple module to run commands in an X terminal
This is just a wrapper around spawn to launch commands in an X terminal: runInXTerm will check the for the XTERMCMD environmental variable, and use it to run the command. If the variable is not set the command will be executed with xterm. darcs-hash:20070807101603-32816-17799bba353c4b0fd5816842e8659512874d708f.gz
Diffstat (limited to 'RunInXTerm.hs')
-rw-r--r--RunInXTerm.hs31
1 files changed, 31 insertions, 0 deletions
diff --git a/RunInXTerm.hs b/RunInXTerm.hs
new file mode 100644
index 0000000..3b88858
--- /dev/null
+++ b/RunInXTerm.hs
@@ -0,0 +1,31 @@
+-----------------------------------------------------------------------------
+-- |
+-- Module : XMonadContrib.RunInXTerm
+-- Copyright : (C) 2007 Andrea Rossato
+-- License : BSD3
+--
+-- Maintainer : andrea.rossato@unibz.it
+-- Stability : unstable
+-- Portability : unportable
+--
+-- A simple module to launch commands in an X terminal
+-- from XMonad
+--
+-----------------------------------------------------------------------------
+
+module XMonadContrib.RunInXTerm (
+ -- * Usage
+ -- $usage
+ runInXTerm
+ ) where
+
+import XMonad
+import System.Environment
+
+-- $usage
+-- For an example usage see SshPrompt
+
+runInXTerm :: String -> X ()
+runInXTerm com = do
+ c <- io $ catch (getEnv "XTERMCMD") (const $ return "xterm")
+ spawn ("exec " ++ c ++ " -e " ++ com)