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

hyprland/language: Fix commas in keyboard names and layouts #3406

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tirsek
Copy link

@tirsek tirsek commented Jul 3, 2024

Commit 29917fb ("Fix hyprland/language events not working with keyboard names with commas in them (#3224)") attempted to fix the problem, but introduced the opposite problem.

The event data from Hyprland is "activelayout>>KEYBOARDNAME,LAYOUTNAME", but both KEYBOARDNAME and LAYOUTNAME may contain embedded commas, so the simple find_first_of(',') or find_last_of(',') solutions will break things for different users.

This patch attempts to solve the problem by trying all combinations of keyboardname and layoutname until one makes sense, either by matching the keyboard name to the user-configured device name, or by matching the layoutname to the list of valid layouts.

@tirsek
Copy link
Author

tirsek commented Jul 3, 2024

@zjeffer How about this suggestion? It works for my no-commas keyboard, but with the layout with commas. I've tested the code snippet ex vivo with no issues, but perhaps @dxrknesss can confirm that it still works for your keyboard this way as well? Thanks!

@zjeffer
Copy link
Contributor

zjeffer commented Jul 3, 2024

I feel like this should be fixed in Hyprland tbh. It doesn't make sense to use , as a delimiter if both keyboardname and layoutname can have comma's.

@zjeffer
Copy link
Contributor

zjeffer commented Jul 3, 2024

There seems to already be an issue open for this: hyprwm/Hyprland#6298

Maybe you could open a PR in Hyprland's repo to fix this?

@Alexays Alexays force-pushed the master branch 2 times, most recently from d623a89 to a4d31ab Compare September 13, 2024 07:40
Commit 29917fb ("Fix hyprland/language events not working with keyboard
names with commas in them (Alexays#3224)") attempted to fix the problem, but
introduced the opposite problem.

The event data from Hyprland is "activelayout>>KEYBOARDNAME,LAYOUTNAME",
but both KEYBOARDNAME and LAYOUTNAME may contain embedded commas, so the
simple `find_first_of(',')` or `find_last_of(',')` solutions will break
things for different users.

This patch attempts to solve the problem by trying all combinations of
keyboardname and layoutname until one makes sense, either by matching
the keyboard name to the user-configured device name, or by matching the
layoutname to the list of valid layouts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants