Support platforms without KDE idle mechanism #39
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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] #35
Summary:
This PR updates
aw-watcher-window-wayland
to handle platforms without KDE idle mechanism by modifyingassign_idle_timeout
to return aResult
and adjusting idle event handling insrc/main.rs
.Key points:
src/idle.rs
to modifyassign_idle_timeout
to returnResult<(), String>
instead of panicking.src/main.rs
.src/main.rs
to print error message if KDE idle mechanism is not available.src/main.rs
.Generated with ❤️ by ellipsis.dev