summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDon Stewart <dons@cse.unsw.edu.au>2007-03-07 08:19:10 +0100
committerDon Stewart <dons@cse.unsw.edu.au>2007-03-07 08:19:10 +0100
commita049400c271ba2e37b531ba373d9ddcaf3c905d9 (patch)
tree213c5d1ce9df3646bcddc33855bc0cf1ed32bedf
parentae7c8c61042e3fe44af9238bdd351b16fb0f5ee0 (diff)
downloadmetatile-a049400c271ba2e37b531ba373d9ddcaf3c905d9.tar
metatile-a049400c271ba2e37b531ba373d9ddcaf3c905d9.zip
Add alt-c, kill client
darcs-hash:20070307071910-9c5c1-08ff3d3b55c56a7438a17ca9cdc4b0362d70e77c
-rw-r--r--Main.hs39
1 files changed, 28 insertions, 11 deletions
diff --git a/Main.hs b/Main.hs
index 4ba7668..a332401 100644
--- a/Main.hs
+++ b/Main.hs
@@ -28,6 +28,21 @@ import Control.Monad.State
import W
--
+-- The keys list
+--
+keys :: [(KeyMask, KeySym, W ())]
+keys =
+ [ (mod1Mask .|. shiftMask, xK_Return, spawn "xterm")
+ , (mod1Mask, xK_p, spawn "exe=`dmenu_path | dmenu` && exec $exe")
+ , (controlMask, xK_space, spawn "gmrun")
+ , (mod1Mask, xK_Tab, focus 1)
+ , (mod1Mask, xK_j, focus 1)
+ , (mod1Mask, xK_k, focus (-1))
+ , (mod1Mask .|. shiftMask, xK_c, kill)
+ , (mod1Mask .|. shiftMask, xK_q, io $ exitWith ExitSuccess)
+ ]
+
+--
-- let's get underway
--
main :: IO ()
@@ -63,17 +78,6 @@ registerKeys dpy root =
kc <- io (keysymToKeycode dpy sym)
io $ grabKey dpy kc mod root True grabModeAsync grabModeAsync
-keys :: [(KeyMask, KeySym, W ())]
-keys =
- [ (mod1Mask .|. shiftMask, xK_Return, spawn "xterm")
- , (mod1Mask, xK_p, spawn "exe=`dmenu_path | dmenu` && exec $exe")
- , (controlMask, xK_space, spawn "gmrun")
- , (mod1Mask, xK_Tab, focus 1)
- , (mod1Mask, xK_j, focus 1)
- , (mod1Mask, xK_k, focus (-1))
- , (mod1Mask .|. shiftMask, xK_q, io $ exitWith ExitSuccess)
- ]
-
--
-- The event handler
--
@@ -162,3 +166,16 @@ focus n = withWindows (rotate n)
-- | spawn. Launch an external application
spawn :: String -> W ()
spawn = io_ . runCommand
+
+-- | Kill the currently focused client
+kill :: W ()
+kill = do
+ ws <- gets windows
+ dpy <- gets display
+ case ws of
+ [] -> return ()
+ (w:_) -> do
+ -- if(isprotodel(sel))
+ -- sendevent(sel->win, wmatom[WMProtocols], wmatom[WMDelete]);
+ io $ xKillClient dpy w -- ignoring result
+ return ()