InputScope under wayland?
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)?
On further reading, it seems keyloggers arent really straightforward on wayland.
this seems to list keycodes logs under wayland: sudo libinput debug-events --show-keycodes maybe this could be interfaced to inputscope somehow.
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
$ 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
nothing much seems to be working...
What happens if you try without the DISPLAY=:0 in front of command?
then i get some exception and it dies. let me try so you can see
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?
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
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.