swaywm / swayidle

Idle management daemon for Wayland
MIT License
550 stars 50 forks source link

swayidle enters idle state during YouTube/Plex playback in browser #165

Closed wadeduvall closed 5 months ago

wadeduvall commented 6 months ago

Previously, swayidle would block during playback in the browser. Recently, this seems to no longer work (maybe 1-2 weeks ago this started). I'm running ArchLinux (btw) and my browser is Firefox.

System details:

$ sway --version
swayfx version 0.4-cf59f67 (May  2 2024, branch 'master') (based on sway 1.9.0)
$ paru -Qs swayidle
local/swayidle 1.8.0-1
$ firefox --version
Mozilla Firefox 125.0.3
$ paru -Qs systemd
local/systemd 255.5-4
    system and service manager

I can test on native sway if you think that will resolve the issue.

Here is the debug output during YouTube playback:

$ swayidle -w -d \
          timeout 300 'swaylock --grace 3' \
          lock swaylock \
          before-sleep 'swaylock'

2024-05-05 08:19:43 - [Line 903] Got timeout
2024-05-05 08:19:43 - [Line 750] Register idle timeout at 300000 ms
2024-05-05 08:19:43 - [Line 751] Setup idle
2024-05-05 08:19:43 - [Line 713] Command: swaylock --grace 3
2024-05-05 08:19:43 - [Line 912] Got lock
2024-05-05 08:19:43 - [Line 713] Command: swaylock
2024-05-05 08:19:43 - [Line 818] Setup lock hook: swaylock
2024-05-05 08:19:43 - [Line 906] Got before-sleep
2024-05-05 08:19:43 - [Line 713] Command: swaylock
2024-05-05 08:19:43 - [Line 778] Setup sleep lock: swaylock
2024-05-05 08:19:43 - [Line 1078] No config file found.
2024-05-05 08:19:43 - [Line 463] Using session: /org/freedesktop/login1/session/_313
2024-05-05 08:19:43 - [Line 223] Got sleep lock: 11
2024-05-05 08:19:43 - [Line 621] Enable idle timeouts
2024-05-05 08:19:43 - [Line 596] Register with timeout: 300000
2024-05-05 08:26:36 - [Line 650] idle state
2024-05-05 08:26:36 - [Line 146] Cmd exec swaylock --grace 3
2024-05-05 08:26:36 - [Line 172] Spawned process swaylock --grace 3
2024-05-05 08:26:36 - [Line 174] Blocking until process exits
2024-05-05 08:26:50 - [Line 179] Process exit status: 0
2024-05-05 08:26:50 - [Line 663] active state

I'm also open to this being an issue outside of swayidle, I'm not exactly sure what triggers the idle state.

kennylevinsen commented 6 months ago

The idle state is triggered by sway once the specific activity timeout is hit, whenever no idle inhibitor is active.

The issue is either:

  1. The application does not register an idle inhibitor correctly
  2. Sway is not handling the inhibitor correctly
wadeduvall commented 5 months ago

Switching to sway did not resolve the issue. Issue also exists with hypridle. So in theory you could probably close this issue. BUT if you still want to help:

@kennylevinsen I did check, and mpv does inhibit properly, so I'm guessing it's not sway's fault. Do you know how to check if idle inhibit is set?

wadeduvall commented 5 months ago

Okay, this is 100% not y'all's issue:

method call time=1715027322.089262 sender=:1.110 -> destination=:1.11 serial=47 path=/ScreenSaver; interface=org.freedesktop.ScreenSaver; member=Inhibit
   string "firefox"
   string "video-playing"
error time=1715027322.089362 sender=:1.11 -> destination=:1.110 error_name=org.freedesktop.DBus.Error.UnknownObject reply_serial=47
   string "Unknown object '/ScreenSaver'."

Closing.