rcaelers / workrave

Workrave is a program that assists in the recovery and prevention of Repetitive Strain Injury (RSI). The program frequently alerts you to take micro-pauses, rest breaks and restricts you to your daily limit.
https://www.workrave.org
GNU General Public License v3.0
1.61k stars 204 forks source link

Workrave doesn't recognize watching video as idle time on some Wayland compositors #565

Open jjramsey opened 4 months ago

jjramsey commented 4 months ago

Describe the bug If I watch a YouTube video in Firefox on Labwc or Hyprland, Workrave will act as if I'm not idle, even if I'm not touching the mouse or keyboard.

Workrave behaves as desired on KDE, though.

Expected behavior Workrave should recognize idle time as, well, idle time.

Linux (please complete the following information in case you encountered the bug on Linux):

Additional context

I have a strong suspicion that this has something to do with the Wayland idle inhibit protocol, as well as different apps having different ideas on what "idle" means (i.e., where the user in front of the keyboard is idle or if the computer itself is.)

[I had a rant here that sort of amounted to "idle inhibit considered harmful", but I got rid of it because, well, it was a rant.]

jjramsey commented 4 months ago

One thing that seems to have helped is installing xdg-desktop-portal-gtk on Arch, which implements the org.freedesktop.impl.portal.Inhibit interface. I think what this does is allow Firefox to send dbus messages that inhibit idle without having the Wayland compositor treat that as non-idleness, but I'm not sure.

(Interestingly enough, the issue that plagued me seems to have been discussed about 4 years ago but possibly resolved too simply: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/29#note_561742 Maybe you can yell at whoever handles the Wayland protocols to get a revision?)

jjramsey commented 2 months ago

FWIW, I've posted an issue on the Wayland protocols Gitlab related to the problem that I described: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/213

rcaelers commented 2 months ago

In the GNOME/Mutter activity monitor, I switch to polling when an "Inhibit" is received from the GNOME session manager. Something similar may be possible in Wayland. I will check if I can reproduce this.

jjramsey commented 2 weeks ago

In the GNOME/Mutter activity monitor, I switch to polling when an "Inhibit" is received from the GNOME session manager. Something similar may be possible in Wayland.

I'm not sure how you'd pull it off. If I look at the current Wayland idle-inhibit protocol, there's a way for a Wayland client to create an inhibitor object and to destroy one, but no way for some other Wayland client to detect if an inhibitor object has been created.

Honestly, I'm not sure if there's a way around the problem that doesn't involve deprecating or reworking the idle inhibit protocol. Unfortunately, there doesn't seem to be much movement about the issue I posted on the Wayland protocol Gitlab about this. Maybe you could help get some attention on the issue?