Add alt-c, kill client

This commit is contained in:
Don Stewart
2007-03-07 07:19:10 +00:00
parent b3d4730ef4
commit ebe2ddf2e4

39
Main.hs
View File

@@ -27,6 +27,21 @@ import Control.Monad.State
import W 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 -- let's get underway
-- --
@@ -63,17 +78,6 @@ registerKeys dpy root =
kc <- io (keysymToKeycode dpy sym) kc <- io (keysymToKeycode dpy sym)
io $ grabKey dpy kc mod root True grabModeAsync grabModeAsync 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 -- The event handler
-- --
@@ -162,3 +166,16 @@ focus n = withWindows (rotate n)
-- | spawn. Launch an external application -- | spawn. Launch an external application
spawn :: String -> W () spawn :: String -> W ()
spawn = io_ . runCommand 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 ()