hyprwm / Hypr

Hypr is a tiling window manager written in modern C++.
BSD 3-Clause "New" or "Revised" License
1.05k stars 32 forks source link

Keycode #82

Closed yfery closed 2 years ago

yfery commented 2 years ago

I'm using multiple keyboard layout (azerty and qwerty).

OK with qwerty, KO with azerty: bind=SUPER,3,workspace,3 KO with qwerty, OK with azerty: bind=SUPER,quotedbl,workspace,3

So for switching between workspace, I would like to use keycode. But it doesn't work.

KO with qwerty, KO with azerty: bind=SUPER,12,workspace,3

Am I configuring the right way?

vaxerski commented 2 years ago

use xev to retrieve keycodes. Remember xev prints them in hex, and hypr takes dec.

xev -event keyboard iirc

12 seems wrong

yfery commented 2 years ago

With xev -event keyboard, When I pressed the "3" key, I get for azerty

KeyPress event, serial 28, synthetic NO, window 0x2600001,
    root 0x7ed, subw 0x0, time 459988, (164,75), root:(1131,117),
    state 0x0, keycode 12 (keysym 0x22, quotedbl), same_screen YES,
    XLookupString gives 1 bytes: (22) """
    XmbLookupString gives 1 bytes: (22) """
    XFilterEvent returns: False

And for qwerty layout:

KeyPress event, serial 42, synthetic NO, window 0x2600001,
    root 0x7ed, subw 0x0, time 836063, (476,166), root:(498,713),
    state 0x0, keycode 12 (keysym 0x33, 3), same_screen YES,
    XLookupString gives 1 bytes: (33) "3"
    XmbLookupString gives 1 bytes: (33) "3"
    XFilterEvent returns: False

We get 12 as keycode for each layout, and it seems that keycode is dec (0 to 255).

I tried with keysym, translated into dec, and it worked. But there have a different value for each layout.

vaxerski commented 2 years ago

yes, keysyms is what Hypr uses and yes, they have a different value for each layout.

yfery commented 2 years ago

So, to manage my different layouts, the best way is to use different config files and reloading them when I change the layout?

vaxerski commented 2 years ago

probably, yes.

yfery commented 2 years ago

ok, thanks for your help and for your awesome software