<div dir="ltr">On Mon, Jul 2, 2012 at 7:17 AM, Matthew Hague <span dir="ltr">&lt;<a href="mailto:matthewhague@zoho.com" target="_blank">matthewhague@zoho.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Is there a way to capture a release of the modkey using e.g. the event hooks?<br>
<br>
I&#39;ve tried modifying the source for debugkeyevents:<br>
<br>
    <a href="http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-DebugKeyEvents.html" target="_blank">http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-DebugKeyEvents.html</a><br>
<br>
but this only captures the release of &quot;proper&quot; keys, not the modifiers.  (E.g.<br>
pressing mod+j will generate a press and release of the j key (with<br>
information about it&#39;s modifiers), but not the press and release of the<br>
modkey).<br></blockquote><div><br></div><div>This is because there are no grabs established on the bare modifiers, nor is there a generic &quot;send all key events&quot; mask in place, so X11 doesn&#39;t bother to send events for them.  If it sent an event for every little thing that happened, unsolicited, most programs would be busy-looping on noise events instead of doing useful work; as such, you should always remember to *request* the events you want.</div>
<div><br></div><div>So in this case you probably want to use grabKey (aka XGrabKey()) to select for interest in the modifier key by itself; the handleEventHook handler should ungrab the keyboard (you don&#39;t *really* want xmonad to seize ownership of the keyboard every time you touch the key), do whatever you want to do, and pass the event on.</div>
<div><br></div><div>(This is largely what the other suggestion does, once you poke at the code.)</div><div><br></div></div>-- <br>brandon s allbery                                      <a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a><br>
wandering unix systems administrator (available)     (412) 475-9364 vm/sms<br><br>
</div>