Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second keyboard layout makes binds behave differently #283

Open
fyrk opened this issue Apr 7, 2024 · 5 comments
Open

Second keyboard layout makes binds behave differently #283

fyrk opened this issue Apr 7, 2024 · 5 comments
Labels
bug Something isn't working question Further information is requested

Comments

@fyrk
Copy link

fyrk commented Apr 7, 2024

Say I have these keybinds configured:

Mod+odiaeresis { spawn "org.mozilla.firefox"; }
Mod+R { spawn "swaylock"; }

(odiaeresis is "Ö", as reported by wez)

I use the Noted layout, and have configured it using layout "noted", which makes the keybinds work as expected.

If, however, I add a second layout (layout "noted,de"), the first keybind stops working (just types an "ö"), while the second one works as before. Interestingly, changing the first keybind to Mod+B { spawn "org.mozilla.firefox"; } will make it work with two layouts (Noted's "Ö" is B on a QWERTZ/Y layout)

System Information

  • niri version: niri unstable 2024-03-22 (commit 0d2fdb4)
@fyrk fyrk added the bug Something isn't working label Apr 7, 2024
@YaLTeR
Copy link
Owner

YaLTeR commented Apr 7, 2024

@kchibisov any idea what's going on here? Maybe something to do with "raw latin or keysym" resolution?

@kchibisov
Copy link
Contributor

The latin key is traversed in all layouts, de likely has a latin key here, so it's not getting checked in other layout? One solution would be to check all latin layouts, but it could be really confusing, since you know that you have a key in a completely different place on this particular layout.

So I'd say that the current behavior is expected because DE layout is latin capable, and it doesn't have such binding at all. Maybe it should resolve other layouts, but it's really tricky.

I'd probably suggest to change the way how the bindings resolution is done, by having a bindings layout or something, probably much simpler and reliably than a bunch of heuristics, though, it could be not that consistent in regular apps...

@YaLTeR
Copy link
Owner

YaLTeR commented May 24, 2024

@fyrk I wonder, do you see the same issue in apps? With a bind like Ctrl+odiaeresis.

@YaLTeR YaLTeR added the question Further information is requested label May 24, 2024
@fyrk
Copy link
Author

fyrk commented May 24, 2024

Okay, so, I made a few tests.

  • setting layout "noted,ru" makes Mod+ö open Firefox, as expected, so apparently the issue does not appear with all second keyboard layouts
  • adding map ctrl+ö new_window to kitty's config and pressing Ctrl+ö works regardless of second keyboard layout.
    This is printed by kitty --debug-keyboard with any of the three layout configurations (yes, alternate_key is always 98 (b)):
    Press xkb_keycode: 0x30 clean_sym: odiaeresis composed_sym: odiaeresis mods: ctrl glfw_key: 246 (ö) xkb_key: 246 (odiaeresis) alternate_key: 98 (b)
    

I also noticed that typing Mod+odiaresis using "noted,de" types an "ö" in some apps, but not in others. Not sure if this is related. Here's a small table:

layout "noted", "noted,ru" "noted,de" "noted", "noted,ru" "noted,de"
niri.kdl shortcut → Mod+odiaresis Mod+odiaresis Mod+R Mod+R
App ↓
Firefox (Flatpak) opens FF nothing locks locks
codium (nixpkgs) opens FF types "ö" locks locks
kitty (nixpkgs) opens FF types "^[[246;9u" locks locks

Is there anything else I can test?

@YaLTeR
Copy link
Owner

YaLTeR commented May 25, 2024

Thanks for the testing.

setting layout "noted,ru" makes Mod+ö open Firefox, as expected, so apparently the issue does not appear with all second keyboard layouts

Yes, that is expected. The problem here is that the ö key produces a latin character on the de layout, so when the de layout is present, this latin character preferred for the binding resolution. The ru layout does not have any latin characters so it doesn't change the binding resolution. You could try with us for example which should also have a latin character there, and it should show a similar issue.

Is there anything else I can test?

Yeah, would you be able to try what a Ctrl+ö (or Alt+ö or Shift+ö, anything) bind does in other toolkits too, not just kitty? E.g. Firefox (GTK 3), something GTK 4, VSCode. Specifically, do they reproduce the same issue where with just noted it works, but with noted,de it doesn't work (and instead only Ctrl+B will work).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants