[xmonad] submapDefault patch - default action for submaps

Anders Engström ankaan at gmail.com
Sun Apr 26 13:36:59 EDT 2009

Hello Stacey and the list since this includes a patch.

I could not reproduce the behaviour, but I can clearly see where it
fits in. The problem for me is that I cannot currently change the
repeat rate (because of a bug in evdev) and my repeat rate is
obviously too low for the bug to appear, but that is another issue.

The problem is as you stated that ungrab-grab is run between key
presses, so I moved the ungrab till after the selected command has
been run. This should result in "grab new"-"ungrab old" behaviour and
fix your problem, I think, but I haven't actually reproduced the bug
so please check if this works and report the success or failure.

It all seems to work for me, but I would like some feedback from
someone a little bit more experienced than me since I'm rather new to
haskell and xmonad myself.
First question: It is okay to run grabKeyboard in a nested way like this, right?
Second question: I dunno, is it just me, or is
grabKeyboard/ungrabKeyboard not defined ANYWHERE? It must come from
somewhere... But I could not find it when I tried to follow the import

/Anders Engström

2009/4/26 Stacey Sheldon <stac at solidgoldbomb.org>:
> I'm trying to use the submapDefault functionality that you contributed
> to XMonad, and I'm running into a small problem with it.  Any assistance
> that you can offer on this would be very much appreciated.  If there are
> any additional details that you require, I'd be happy to provide them.
> [Goal]
> I want to trigger a sticky submap, and then be able to move a floating
> window around with the arrow keys.  When I hit enter or escape, I want
> to return to the normal keybindings.  The basic functionality works as
> expected so I think I've got the various moving parts connected properly.
> [Problem]
> When I use the arrow keys to move the windows around, I typically hold
> down the arrow key until the window ends up in the right position.  I've
> noticed that some of the repeats of the arrow key are leaking through to
> the focused window rather than being captured by the submap.  This is
> especially noticeable if I switch to using vi keys (h,j,k,l) rather than
> the arrow keys to push the floating windows around.  I then get a string
> of these leaked h's in the focused window.
> I suspect this is caused by the ungrabKeyboard that (I think) happens
> between handling one keypress and handling the next (repeating) one.  If
> the ungrab only occurred once the "exit" key had been pressed, maybe
> this problem would go away.
> I'm not a complete haskell noob but I still don't quite have a handle on
> how monads work.  I have no idea how to fix this.
> [Context]
> I'm fairly certain that the issue that I'm seeing is unrelated to the
> particular versions that I'm using but I'll give you the context anyway.
>     I'm using XMonad 0.8-1 on Ubuntu Intrepid (8.10) as the base
> version.  I've pulled the definition for submapDefault from the latest
> darcs revision into my xmonad.hs file since your patch isn't in the
> ubuntu release.
> I'm using submapDefault like this in my xmonad.hs file:
> entersub = submapDefault entersub sublist
> sublist = M.fromList $
>  [ -- Window floating stuff
>      ((0, xK_Return), return ())
>    , ((0, xK_Escape), return ())
>    , ((0, xK_t     ), withFocused $ windows . W.sink)
>    , ((0, xK_Left  ), (withFocused
>                        (keysMoveWindow (-20,0))) >> entersub)
>    , ((0, xK_Right ), (withFocused
>                        (keysMoveWindow (20,0))) >> entersub)
>    , ((0, xK_Up    ), (withFocused
>                        (keysMoveWindow (0,-20))) >> entersub)
>    , ((0, xK_Down  ), (withFocused
>                        (keysMoveWindow (0,20))) >> entersub)
>  ]
> If you've got the time to look at this, I'd be happy to try any
> suggestions for how to fix this.
> Thanks.
> Stacey.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: submapDefaultFixLeak.dpatch
Type: application/octet-stream
Size: 34715 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/xmonad/attachments/20090426/b7568910/submapDefaultFixLeak-0001.obj

More information about the xmonad mailing list