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

Wayland support with keyboard emulation and capture using uinput #1679

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

LilleAila
Copy link

@LilleAila LilleAila commented Jul 11, 2024

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 the following new dependencies:

  • xkbcommon
  • evdev

This should close #1655 and close #1050

Remaining stuff to do

  • Add tests
    • The already existing test/test_keyboard.py should work with this, and the tests pass when running tox r -e test
  • Add news
  • Implement suppressing in KeyboardCapture, probably by passing the keys to KeyboardEmulation as a workaround
  • Figure out a way to get the system's keyboard layout used by the emulated keyboard
    • There is a config option. The default value is 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.
  • Figure out how to install the udev rule automaticaly (KERNEL=="uinput", GROUP="input", MODE="0660", OPTIONS+="static_node=uinput")
    • The rule now gets installed, but the code for it is not the best
  • Resolve error Qt: Wayland does not support QWindow::requestActivate()

Pull Request Checklist

  • Changes have tests
  • News fragment added in news.d. See documentation for details

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()
Copy link

@fearofcode fearofcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

[wayland]: KDE on Wayland Not working with Gnome on Wayland in Linux
2 participants