From 51ade462945bb3b668331f03c75efae71095fa69 Mon Sep 17 00:00:00 2001 From: Jason Creighton Date: Tue, 24 Apr 2007 03:33:57 +0200 Subject: Ignore numlock and capslock in keybindings darcs-hash:20070424013357-b9aa7-aed2e5623aa5d0f804d131974fc9b6c21c7a2ce1.gz --- Config.hs | 4 +++- Main.hs | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Config.hs b/Config.hs index d90f0f8..4e905f4 100644 --- a/Config.hs +++ b/Config.hs @@ -101,8 +101,10 @@ defaultDelta :: Rational defaultDelta = 3%100 -- The mask for the numlock key. You may need to change this on some systems. +-- You can find the numlock modifier by running "xmodmap" and looking for a +-- modifier with Num_Lock bound to it. numlockMask :: KeyMask -numlockMask = lockMask +numlockMask = mod2Mask -- What layout to start in, and what the default proportion for the -- left pane should be in the tiled layout. See LayoutDesc and diff --git a/Main.hs b/Main.hs index aa541ce..6932867 100644 --- a/Main.hs +++ b/Main.hs @@ -94,7 +94,7 @@ grabKeys dpy rootw = do ungrabKey dpy '\0' {-AnyKey-} anyModifier rootw flip mapM_ (M.keys keys) $ \(mask,sym) -> do kc <- keysymToKeycode dpy sym - mapM_ (grab kc) [mask, mask .|. numlockMask] -- note: no numlock + mapM_ (grab kc) [mask, mask .|. numlockMask, mask .|. lockMask, mask .|. numlockMask .|. lockMask] where grab kc m = grabKey dpy kc m rootw True grabModeAsync grabModeAsync @@ -128,7 +128,7 @@ handle (KeyEvent {ev_event_type = t, ev_state = m, ev_keycode = code}) | t == keyPress = withDisplay $ \dpy -> do s <- io $ keycodeToKeysym dpy code 0 - whenJust (M.lookup (complement numlockMask .&. m,s) keys) id + whenJust (M.lookup (complement (numlockMask .|. lockMask) .&. m,s) keys) id -- manage a new window handle (MapRequestEvent {ev_window = w}) = withDisplay $ \dpy -> do -- cgit v1.2.3