aboutsummaryrefslogtreecommitdiffstats
path: root/Main.hs
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
commit7357ee0ad88da98ed46dc05cc1ae02a96cc775f3 (patch)
tree928f0f09b8fbae45b18083fd2c3b28e55ebaaf37 /Main.hs
parente1334df795b0bf5054113a1e65ca2f5bff204a3f (diff)
downloadxmonad-7357ee0ad88da98ed46dc05cc1ae02a96cc775f3.tar.gz
xmonad-7357ee0ad88da98ed46dc05cc1ae02a96cc775f3.tar.xz
xmonad-7357ee0ad88da98ed46dc05cc1ae02a96cc775f3.zip
restart (simple exec(), no state saved)
darcs-hash:20070323023738-b9aa7-7adfc53755ed749406c50da63883ee36e5a69565.gz
Diffstat (limited to 'Main.hs')
-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
--