From 7357ee0ad88da98ed46dc05cc1ae02a96cc775f3 Mon Sep 17 00:00:00 2001 From: Jason Creighton Date: Fri, 23 Mar 2007 03:37:38 +0100 Subject: restart (simple exec(), no state saved) darcs-hash:20070323023738-b9aa7-7adfc53755ed749406c50da63883ee36e5a69565.gz --- Main.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Main.hs') 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 -- -- cgit v1.2.3