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

InputScope under wayland? #33

Open
jave opened this issue Sep 21, 2024 · 11 comments
Open

InputScope under wayland? #33

jave opened this issue Sep 21, 2024 · 11 comments

Comments

@jave
Copy link

jave commented Sep 21, 2024

I'm switching from i3wm to sway, and InputScope doesnt seem to work, no keyboard events seem to be monitored.
Is InputScope verified to work under wayland (sway in my case)?

@jave
Copy link
Author

jave commented Sep 21, 2024

On further reading, it seems keyloggers arent really straightforward on wayland.

@jave
Copy link
Author

jave commented Sep 21, 2024

this seems to list keycodes logs under wayland:
sudo libinput debug-events --show-keycodes
maybe this could be interfaced to inputscope somehow.

@suurjaak
Copy link
Owner

Haven't experimented with Wayland myself, and at the moment I am not able to.

Looking at the documentation for pynput, the library that InputScope uses for events, Wayland support is iffy indeed (https://pynput.readthedocs.io/en/latest/limitations.html#linux and https://pynput.readthedocs.io/en/latest/index.html#forcing-a-specific-backend).

Can you try running the program as root? For Wayland, it needs the following environment:

export PYNPUT_BACKEND_KEYBOARD=uinput

@jave
Copy link
Author

jave commented Sep 23, 2024

$ xhost +
access control disabled, clients can connect from any host
01:31:47-joakim@framework:~/roles/Tools/InputScope
$ sudo DISPLAY=:0 PYTHONPATH=/home/joakim/.local/lib/python3.12/site-packages PYNPUT_BACKEND_KEYBOARD=uinput PYNPUT_BACKEND_MOUSE=dummy  ~/.local/bin/inputscope

** (inputscope:722274): WARNING **: 01:31:50.749: AT-SPI: Could not obtain desktop path or name


** (inputscope:722274): WARNING **: 01:31:50.750: atk-bridge: GetRegisteredEvents returned message with unknown signature

** (inputscope:722274): WARNING **: 01:31:50.750: atk-bridge: get_device_events_reply: unknown signature
Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib64/python3.12/threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "/home/joakim/.local/lib/python3.12/site-packages/pynput/_util/__init__.py", line 211, in run
    self._run()
  File "/home/joakim/.local/lib/python3.12/site-packages/pynput/_util/__init__.py", line 260, in _run
    raise NotImplementedError()
NotImplementedError

@jave
Copy link
Author

jave commented Sep 23, 2024

image

@jave
Copy link
Author

jave commented Sep 23, 2024

nothing much seems to be working...

@suurjaak
Copy link
Owner

What happens if you try without the DISPLAY=:0 in front of command?

@jave
Copy link
Author

jave commented Sep 24, 2024

then i get some exception and it dies. let me try so you can see

@jave
Copy link
Author

jave commented Sep 24, 2024

sudo DISPLAY= PYTHONPATH=/home/joakim/.local/lib/python3.12/site-packages PYNPUT_BACKEND_KEYBOARD=uinput PYNPUT_BACKEND_MOUSE=dummy ~/.local/bin/inputscope
Unable to access the X Display, is $DISPLAY set properly?

@jave
Copy link
Author

jave commented Sep 24, 2024

btw for my use-case (figuring out which keys I use so I can build a zsa voyager keyboard layout) I dont need mouse, so thats why I use PYNPUT_BACKEND_MOUSE=dummy

@suurjaak
Copy link
Owner

I will try to get native Linux installed somewhere at some point, and look into this further.

Unfortunately this may take a while. Leaving this issue open until then.

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

No branches or pull requests

2 participants