Discussion:
Strange event prevents i3 from recognizing its keyboard shortcuts
(too old to reply)
Nikolay Aleksandrovich Pavlov (ZyX)
2017-12-02 22:41:40 UTC
Permalink
Hello. I am currently suffering from the strange bug(?) described as following:
at some point of time something happens and keyboard handling gets messed up,
specifically

- i3 (as well as fluxbox when I used it) stops receiving any keyboard shortcuts.
By default I have it configured to use `<A-` shortcuts (i.e. Mod1+
), but if
I change config to something like Control and do `i3-msg reload` this is
neither received. Other applications which previously were not receiving i3
keyboard shortcuts started to receive them.
- My terminal application (konsole) changes what is sent for `<Fn>` keys, i.e.
in place of `<Esc>[11~` it starts sending `<Esc>[12;1~`. `<F1>` is still
`<F1>` in xev.
- Backspace no longer received by any applications, including xev. For the
latter it was turned into NoSymbol.
- `<C-A-Fn>` no longer switch to kernel terminals.

Some unsuccessfull attempts to fix the issue were

- Reloading i3 configuration.
- Restarting i3 (`i3-msg restart`).
- Doing `setxkbmap -option
'grp_led:scroll,grp:lwin_switch,grp:rctrl_toggle,compose:rwin' dvp2` where
`dvp2` is a keyboard layout derived from programming dvorak.
- Doing `setxkbmap us`.
- Unplugging keyboard and plugging it back.
- Unplugging keyboard and using true PS/2 keyboard instead.
- Unplugging keyboard and plugging it into USB 3.0 port.

`xev` readings (note that it has `state 0x90`, not sure what that means, but it
should be `0x0`, right?):

`<F1>`:

KeyPress event, serial 30, synthetic NO, window 0x4a00001,
root 0x293, subw 0x0, time 129425137, (979,-18), root:(983,0),
state 0x90, keycode 67 (keysym 0xffbe, F1), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x4a00001,
root 0x293, subw 0x0, time 129425198, (979,-18), root:(983,0),
state 0x90, keycode 67 (keysym 0xffbe, F1), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False

`<BS>`:

KeyPress event, serial 30, synthetic NO, window 0x4a00001,
root 0x293, subw 0x0, time 129751312, (891,-18), root:(895,0),
state 0x90, keycode 22 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x4a00001,
root 0x293, subw 0x0, time 129751374, (891,-18), root:(895,0),
state 0x90, keycode 22 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False

`<A-h>` (supposed to be received by i3):

KeyPress event, serial 33, synthetic NO, window 0x4a00001,
root 0x293, subw 0x0, time 129752235, (891,-18), root:(895,0),
state 0x90, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyPress event, serial 33, synthetic NO, window 0x4a00001,
root 0x293, subw 0x0, time 129752353, (891,-18), root:(895,0),
state 0x98, keycode 44 (keysym 0x68, h), same_screen YES,
XLookupString gives 1 bytes: (68) "h"
XmbLookupString gives 1 bytes: (68) "h"
XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x4a00001,
root 0x293, subw 0x0, time 129752394, (891,-18), root:(895,0),
state 0x98, keycode 44 (keysym 0x68, h), same_screen YES,
XLookupString gives 1 bytes: (68) "h"
XFilterEvent returns: False

KeyRelease event, serial 33, synthetic NO, window 0x4a00001,
root 0x293, subw 0x0, time 129752529, (891,-18), root:(895,0),
state 0x98, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False

xev output before first key press: in xev-startup.txt file.

Grab information obtained by

xdotool keydown Alt; xdotool key XF86LogGrabInfo; xdotool keyup Alt

: in xor-grabinfo.txt.
Nikolay Aleksandrovich Pavlov (ZyX)
2017-12-02 23:01:54 UTC
Permalink
Post by Nikolay Aleksandrovich Pavlov (ZyX)
at some point of time something happens and keyboard handling gets messed up,
specifically
- i3 (as well as fluxbox when I used it) stops receiving any keyboard shortcuts.
  By default I have it configured to use `<A-` shortcuts (i.e. Mod1+…), but if
  I change config to something like Control and do `i3-msg reload` this is
  neither received. Other applications which previously were not receiving i3
  keyboard shortcuts started to receive them.
- My terminal application (konsole) changes what is sent for `<Fn>` keys, i.e.
  in place of `<Esc>[11~` it starts sending `<Esc>[12;1~`. `<F1>` is still
  `<F1>` in xev.
- Backspace no longer received by any applications, including xev. For the
  latter it was turned into NoSymbol.
- `<C-A-Fn>` no longer switch to kernel terminals.
Some unsuccessfull attempts to fix the issue were
- Reloading i3 configuration.
- Restarting i3 (`i3-msg restart`).
- Doing `setxkbmap -option
  'grp_led:scroll,grp:lwin_switch,grp:rctrl_toggle,compose:rwin' dvp2` where
  `dvp2` is a keyboard layout derived from programming dvorak.
- Doing `setxkbmap us`.
- Unplugging keyboard and plugging it back.
- Unplugging keyboard and using true PS/2 keyboard instead.
- Unplugging keyboard and plugging it into USB 3.0 port.
`xev` readings (note that it has `state 0x90`, not sure what that means, but it
Apparently that was a problem. When I started to wonder I found those bits in
/usr/include/X11/X.h, under “Key masks. Used as modifiers …” and it appeared
that 0x80 is Mod5, 0x10 is Mod2. Running `xmodmap` without arguments revealed
what those may be:

xmodmap: up to 3 keys per modifier, (keycodes in parentheses):

shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x9)
control Escape (0x25), Control_L (0x42)
mod1 Alt_L (0x40), Mode_switch (0x6c), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3 Mode_switch (0x6c)
mod4 Mode_switch (0x85), Super_L (0xce), Hyper_L (0xcf)
mod5 Scroll_Lock (0x4e), ISO_Level3_Shift (0x5c), Mode_switch (0xcb)

: 0x10 is Num_Lock and I do have it active on purpose, 0x80 is Scroll_Lock and
I have no idea why it is active as I am pretty sure I did not press it. But
pressing it again fixed the issue.
Post by Nikolay Aleksandrovich Pavlov (ZyX)
    KeyPress event, serial 30, synthetic NO, window 0x4a00001,
        root 0x293, subw 0x0, time 129425137, (979,-18), root:(983,0),
        state 0x90, keycode 67 (keysym 0xffbe, F1), same_screen YES,
        XFilterEvent returns: False
    KeyRelease event, serial 33, synthetic NO, window 0x4a00001,
        root 0x293, subw 0x0, time 129425198, (979,-18), root:(983,0),
        state 0x90, keycode 67 (keysym 0xffbe, F1), same_screen YES,
        XFilterEvent returns: False
    KeyPress event, serial 30, synthetic NO, window 0x4a00001,
        root 0x293, subw 0x0, time 129751312, (891,-18), root:(895,0),
        state 0x90, keycode 22 (keysym 0x0, NoSymbol), same_screen YES,
        XFilterEvent returns: False
    KeyRelease event, serial 33, synthetic NO, window 0x4a00001,
        root 0x293, subw 0x0, time 129751374, (891,-18), root:(895,0),
        state 0x90, keycode 22 (keysym 0x0, NoSymbol), same_screen YES,
        XFilterEvent returns: False
    KeyPress event, serial 33, synthetic NO, window 0x4a00001,
        root 0x293, subw 0x0, time 129752235, (891,-18), root:(895,0),
        state 0x90, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
        XFilterEvent returns: False
    KeyPress event, serial 33, synthetic NO, window 0x4a00001,
        root 0x293, subw 0x0, time 129752353, (891,-18), root:(895,0),
        state 0x98, keycode 44 (keysym 0x68, h), same_screen YES,
        XLookupString gives 1 bytes: (68) "h"
        XmbLookupString gives 1 bytes: (68) "h"
        XFilterEvent returns: False
    KeyRelease event, serial 33, synthetic NO, window 0x4a00001,
        root 0x293, subw 0x0, time 129752394, (891,-18), root:(895,0),
        state 0x98, keycode 44 (keysym 0x68, h), same_screen YES,
        XLookupString gives 1 bytes: (68) "h"
        XFilterEvent returns: False
    KeyRelease event, serial 33, synthetic NO, window 0x4a00001,
        root 0x293, subw 0x0, time 129752529, (891,-18), root:(895,0),
        state 0x98, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
        XFilterEvent returns: False
xev output before first key press: in xev-startup.txt file.
Grab information obtained by
    xdotool keydown Alt; xdotool key XF86LogGrabInfo; xdotool keyup Alt
: in xor-grabinfo.txt.
Loading...