aw-watcher-afk
aw-watcher-afk copied to clipboard
Add Wayland support by providing evdev and libinput backends
This PR introduces Wayland support by adding evdev and libinput backends as alternatives to pynput, which only supports X11 and XWayland (docs). These alternatives should provide Wayland support if run as root or with the appropriate group permissions (input group).
Changes:
- Added evdev backend: Bypassing the compositor to handle input events generated in the kernel.
- Added libinput backend: This wrapper is no longer maintained.
Related to issue ActivityWatch/aw-watcher-input#25.
[!IMPORTANT] Add Wayland support with
evdevandlibinputbackends, updating build and configuration files for optionalevdevsupport.
- Behavior:
- Adds Wayland support with
evdevandlibinputbackends inlisteners_evdev.pyandlisteners_libinput.py.evdevbackend is functional and tested;libinputbackend is based on an unmaintained wrapper.listeners.pyupdated to select backend based onUSE_EVDEVandUSE_LIBINPUTenvironment variables.- Build System:
Makefileupdated to includePOETRY_EXTRASforevdevsupport.pyproject.tomlupdated with optionalevdevdependency and extras configuration.- Misc:
- Introduces
evdev_devices.pyfor device detection.- Adds
listeners_pynput.pyto separatepynputbackend logic.This description was created by
for 47a5f10ca7229b970677201c84a3c060af66678f. It will automatically update as commits are pushed.
Why use this method of getting idle status, instead of using the staging Wayland protocol ext-idle-notify, which popular and proven Wayland watchers like awatcher and aw-watcher-window-wayland use?
@johan-bjareholt You are right. However since aw-watcher-input uses the input event listeners found in this module to track keystrokes and mouse movements, aw-watcher-input will be supported on Wayland if this is merged. Currently there is no method for supporting aw-watcher-input on Wayland.
I am not sure why input events are currently tracked here in aw-watcher-afk rather than aw-watcher-input and the idle watcher for ActivityWatch on Linux currently uses input tracking rather than display protocols for tracking idle. As a result this PR will also cause the current implementation of aw-watcher-afk to support Wayland, even if it is only really needed to support aw-watcher-input. It's good to have implementations with Wayland support for both aw-watcher-input and aw-watcher-afk in the activitywatch repo, even if there are better solutions for aw-watcher-afk in other repos. If they are merged in future (awatcher is very good!) then this (and the existing pynput backend ) can be moved to aw-watcher-input.