-
Notifications
You must be signed in to change notification settings - Fork 282
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
Wayland support with keyboard emulation and capture using uinput #1679
Conversation
and added comments about remaining things that have to be done
added suppressing keys and pass through non-suppressed keys
that function is not supported on wayland, and gave this warning: Qt: Wayland does not support QWindow::requestActivate()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
1782a7d
to
21170bd
Compare
@LilleAila after merging the latest
Do you have time to have a look? |
This looks like is because the added python dependency I'm not sure how system dependencies like that should be managed. |
I could remove the dependency on xkbcommon completely, rather manually adding in some simpler general, such as "qwerty", "colemak" and "qwertz", etc, removing the need for traversing a more specific one through xkbcommon. That would make the settings item a dropdown instead of a free input. @mkrnr Does that sound like a good option? |
That's a tricky one. It's of course nice that your current solution supports all xkb layouts. On the other hand, we need to be careful which dependencies we include and how. I'm afraid I can't make a call on this based on my limited understanding. Let's maybe raise that in the plover-dev discord to get some more opinions on this? |
I implemented my idea to see how the code would look. From what i did now, i prefer doing it this way, as i have more control over what happens layout-wise, which i think could avoid bugs related to xkbcommon in the future. The changes could always be reverted, but this new solution is a better compromise in my opinion. |
The CI fails with this error
Does someone have any idea what could cause this? I believe i have added the new dependency in the correct locations such that pip should be able to resolve it. |
@LilleAila you also need to add it to |
Should that file contain a specific version |
90f249c
to
184e661
Compare
Needs to be specific. That's the version that will be installed. |
184e661
to
34aee6b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for the great work @LilleAila! Many people have been asking for this 🙂
I tested it on ubuntu 24.04 (Wayland) and it works great for me! I tested both qwerty and qwertz. In addition, I did a quick test on windows and macOS, just in case.
We'll certainly get a lot of requests for adding keyboard layouts but let's start with this list.
Just a super trivial request regarding a doc string. Other than that, it's good to go for me 🚀
plover/gui_qt/main_window.py
Outdated
""" | ||
Calling .activateWindow() on a window results in this error: | ||
Qt: Wayland does not support QWindow::requestActivate() | ||
This function returns a boolean used to determine whether to run activateWindow() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trivial: I can imagine this method being used in other situations in the future. So better move the info regarding .activeWindow()
inside the two if statements where the .activeWindow()
method is called.
The _is_wayland
method is so easy to understand that I'd probably not put any docstring.
Summary of changes
This adds support for keyboard emulation and capture using uinput. As opposed to #1461, this implements a uinput-based output backend. Uinput is present in most linux distributions, and works at a lower level. This means that it does not rely on a specific protocol, and will work in Wayland, X11 and even the TTY console, as it essentially emulates a keyboard. The drawback to this is that it varies by the software layout, and there is not a way to directly input characters not in the keyboard layout, so it relies on an IME such as iBus or fcitx5. The latter should work fine in window managers like Hyprland or sway from my testing. It assumes the key binding to type unicode is set to the default, which is
ctrl+shift+u
.It adds evdev as a new dependency.
This should close #1655 and close #1050
Remaining stuff to do
test/test_keyboard.py
should work with this, and the tests pass when runningtox r -e test
us
, and it will still work fine for most people using a non-us keyboard, as long as the alphanumeric keys are in the same positions.KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=uinput"
)Qt: Wayland does not support QWindow::requestActivate()
Pull Request Checklist