summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Creighton <jcreigh@gmail.com>2007-03-23 03:37:38 +0100
committerJason Creighton <jcreigh@gmail.com>2007-03-23 03:37:38 +0100
commit7615f442050deda41311abd1217932403cff4ed1 (patch)
tree928f0f09b8fbae45b18083fd2c3b28e55ebaaf37
parentf4897ee9bb57d583bc86853760cfa8e951be647b (diff)
downloadmetatile-7615f442050deda41311abd1217932403cff4ed1.tar
metatile-7615f442050deda41311abd1217932403cff4ed1.zip
restart (simple exec(), no state saved)
darcs-hash:20070323023738-b9aa7-7adfc53755ed749406c50da63883ee36e5a69565
-rw-r--r--Main.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/Main.hs b/Main.hs
index 5cadc99..3e5b865 100644
--- a/Main.hs
+++ b/Main.hs
@@ -28,6 +28,9 @@ import Graphics.X11.Xinerama
import Control.Monad.State
+import System.Posix.Process
+import System.Environment
+
import XMonad
import qualified StackSet as W
@@ -58,6 +61,7 @@ keys = M.fromList $
, ((modMask, xK_l ), changeWidth defaultDelta)
, ((modMask .|. shiftMask, xK_c ), kill)
, ((modMask .|. shiftMask, xK_q ), io $ exitWith ExitSuccess)
+ , ((modMask .|. shiftMask, xK_F12 ), io restart)
, ((modMask, xK_space ), switchLayout)
, ((modMask, xK_Return), promote)
] ++
@@ -156,6 +160,13 @@ grabKeys dpy rootw = do
where
grab kc m = grabKey dpy kc m rootw True grabModeAsync grabModeAsync
+-- | Restart xmonad by exec()'ing self. This doesn't save state and xmonad has
+-- to be in PATH for this to work.
+restart :: IO ()
+restart = do prog <- getProgName
+ args <- getArgs
+ executeFile prog True args Nothing
+
-- ---------------------------------------------------------------------
-- Event handler
--