ActivityWatch / aw-watcher-window-wayland

Window and AFK watcher for some Wayland compositors
Mozilla Public License 2.0
60 stars 14 forks source link

Support platforms without KDE idle mechanism #39

Closed moreheadm closed 2 weeks ago

moreheadm commented 2 months ago

This change allows aw-watcher-window-wayland to work even if the KDE idle mechanism is not present. It does that by attempting to instantiate a KDE Idle object as normal, but not panicking if that fails, and instead marking the idle part of the watcher as inactive, and not making subsequent calls to it.

The background is that Issue #35 [1] reports that sway has switched idle mechanisms to not use the KDE idle mechanism. Presumably, other window managers may also fail to support the KDE idle mechanism. Pending full support for idle-notify-v1, it's still useful to use activity watch on sway to get focused window titles, so this commit allows the program to run on sway.

Some changes to Cargo.lock were necessary to compile.

[1] https://github.com/ActivityWatch/aw-watcher-window-wayland/issues/35


:rocket: This description was created by Ellipsis for commit 4ebb5a41f8b81c77d773870b4ab62619d408bb35

Summary:

This PR updates aw-watcher-window-wayland to handle platforms without KDE idle mechanism by modifying assign_idle_timeout to return a Result and adjusting idle event handling in src/main.rs.

Key points:


Generated with :heart: by ellipsis.dev

johan-bjareholt commented 2 weeks ago

Not the perfect solution, but a good start. Thanks for a simple and clean PR.