>> You could try kpress_wait, which will cause Ion to grab the keyboard until
>> all (non-ignored) modifier keys have been released.
>
> This doesn't appear to work. I bind a key to
> kpress_wait("N", "WFrame.switch_next(_)")
> and on testing with xev, I still see the KeyRelease event when
> switching to the xev window.
Actually, it does seem to do what you say kpress_wait does in that
it waits for all modifier keys to be released. However this
doesn't work for the default key bindings like Mod+K P as the P is
pressed without a modifier key (so it doesn't seem to wait). I
tried rebinding to something like Mod+P and it works (as in not
sending the P) only if the P is released before the modifier
key. I find that on my normal typing, I usually release the
modifier key first before the normal key so the normal key release
is still sent as an event. This is close to fixing the issue if it
would only wait until ALL keys have been released and not just the
modifier keys.