awesome icon indicating copy to clipboard operation
awesome copied to clipboard

Having more than one variants of a keyboard causes some (non modified) keybinds to be dropped.

Open Peilonrayz opened this issue 4 years ago • 2 comments

$ awesome --version
awesome v4.3 (Too long)
 • Compiled against Lua 5.3.5 (running with Lua 5.3)
 • D-Bus support: ✔
 • execinfo support: ✔
 • xcb-randr version: 1.6
 • LGI version: 0.9.2

Issue:

  1. Change your keyboard layout to have more than one layout and variant.

    $ setxkbmap -layout "us,us,us,us" -variant "dvorak,dvorak-l,dvorak-r,"
    
  2. We get us(dvorak) as our layout in Awesome.

  3. The hotkeys Super+fmnot do not work.

    Those keys with modifiers work fine, such as Ctrl+Super+m and Shift+Super+m.

I have tested this with the following six commands.

setxkbmap -layout "us" -variant "dvorak"
# All work.

setxkbmap -layout "us,us,us,us" -variant "dvorak,dvorak-l,dvorak-r,"
# Fail: Super+fmnot

setxkbmap -layout "us,us" -variant "dvorak,dvorak-l"
# Fail: Super+fo

setxkbmap -layout "us,us" -variant "dvorak,dvorak-r"
# Fail: Super+fm

setxkbmap -layout "us,us,us" -variant "dvorak,dvorak-r,dvorak-l"
# Fail: Super+fmo

setxkbmap -layout "us,us" -variant "dvorak,"
# Fail: Super+not

Peilonrayz avatar Jul 13 '20 14:07 Peilonrayz

I'm having the same problem too. For me, only key bindings that are assigned to clients get's effected (but not all keys). Global keys still work.

I played around with xev and putting some printf in the source, and it looks like when pressing those keys, the client loses focus just before the key press, which causes awesome to look for global keys instead of client's keys. I'm not sure what causes that though. Can be problem from xcb?

Right now I'm kind of stuck. If anyone else have an idea on where to look at, I can dig more into it.

Rio6 avatar Jul 28 '20 21:07 Rio6

I don't need to change variants to reproduce this. If my layouts include Hungarian (QWERTZ) or French (AZERTY) my Super+Q and Super+F client bindings break even if the active layout is still US.

gergely-xyz avatar Apr 18 '22 10:04 gergely-xyz

awesome v4.3 (Too long) • Compiled against Lua 5.3.3 (running with Lua 5.3) • D-Bus support: ✔ • execinfo support: ✔ • xcb-randr version: 1.6 • LGI version: 0.9.2

I seem to have the same (or very similar) issue:

I noticed that some keybindings did not work, mainly Super+n (minimize) and Super+f (fullscreen).

I was able to "fix" fullscreen with this change in my config

diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua
index 2ac8e09..c658123 100644
--- a/.config/awesome/rc.lua
+++ b/.config/awesome/rc.lua
@@ -395,7 +395,7 @@ globalkeys = gears.table.join(
 )
 
 clientkeys = gears.table.join(
-    awful.key({ modkey,           }, "f",
+    awful.key({ modkey,           }, "g",
         function (c)
             c.fullscreen = not c.fullscreen
             c:raise()

i.e. it works with g but not with f.

Then today I noticed that it works when I load just one keyboard layout instead of the two I usually load, i.e.

setxkbmap us

makes it (Super+n for minimize) work, while

setxkbmap de,us bone,

breaks it. This is reproducible.

This is on Debian stable.

Can I provide any further information or test anything to help find the cause for this issue?

PS: I also found #1389 which seems very similar. There the 'de'-keyboard layout variant 'neo' is mentioned. 'bone' (which I use) is very similar to 'neo'. Just thought I should mention that.

henk84 avatar Feb 24 '23 19:02 henk84

(some wild guesses that need more investigations)

I think the issue here is that xcb need a keycode to grab the keyuser event.

In Awesome, we translate the symbol to an actual keycode with xcb_key_symbols_get_keycode: https://github.com/awesomeWM/awesome/blob/b54e50ad6cfdcd864a21970b31378f7c64adf3f4/xwindow.c#L121-L142

I guess the different keyboard layouts tried here doesn't use the exact same symbol/keycode combination for every key.

IIRC some users from the Discord chat said that they use keycode in their config to mitigate this problem. Maybe we should ungrab/regrab every keybindings when the keyboard layout is changed to update the keycode :thinking:

Aire-One avatar Apr 01 '23 19:04 Aire-One

it's apparently a dup of https://github.com/awesomeWM/awesome/issues/1389

actionless avatar May 06 '23 02:05 actionless

I'm sorry but I'm unable to mitigate the bug using keycode.

I have:

    awful.key({ modkey,           }, "c",      function (c)
        c:kill()
    end),

That I change with:

    awful.key({ modkey,           }, "#54",      function (c)
        c:kill()
    end),

Work as expected.

When I do: setxkbmap fr,us oss,dvorak. It doesn't work anymore.

I will try to replace every keybindings with keycode but I'm not confident.


Edit: I should have been confident.

If I replace every keybinding by the corresponding keycode (didn't do it for Mod4, Ctrl and Switch), it actually works !

arobase-che avatar Oct 25 '23 08:10 arobase-che