Skip to content

Keep the screensaver off while Firefox-family browsers play media - #8955

Open
michielvandermeer wants to merge 1 commit into
omacom:quattrofrom
michielvandermeer:fix/firefox-media-idle-inhibit
Open

michielvandermeer wants to merge 1 commit into
omacom:quattrofrom
michielvandermeer:fix/firefox-media-idle-inhibit

Conversation

@michielvandermeer

Copy link
Copy Markdown

Fixes #7220. Fixes #7199. Related to #6475.

What happens today

Quattro's idle service uses IdleMonitor { respectInhibitors: true }, which only honors Wayland zwp_idle_inhibit_manager_v1 inhibitors. Firefox, Zen, and LibreWolf request idle inhibit over the GTK portal / org.freedesktop.ScreenSaver while a <video> is playing. Nothing owns that bus name since hypridle was replaced, so the call is a silent no-op and the screensaver comes up over YouTube, Plex, and the rest — windowed or fullscreen.

Chromium-based browsers already speak the Wayland protocol directly and are unaffected.

Reproduced on Omarchy 4.0.1 with Firefox 154 playing Plex in a windowed window: hyprctl clients showed inhibitingIdle: false while MPRIS PlaybackStatus was Playing. Tagging the window noidle (the existing idle_inhibit = always rule) immediately set inhibitingIdle: true.

What this does

  1. The idle service watches MPRIS. While a Firefox-family player reports Playing, it holds idle off the same way Stay Awake does — including cancelling an in-flight screensaver cycle. Pause/stop releases after 2s so a blip does not start the timer. Spotify, Chromium, and other players are left alone.
  2. Firefox-based browser windows also get idle_inhibit = fullscreen, so fullscreen video that never publishes MPRIS still holds idle off.
  3. idle toggle now flips stayAwake rather than the derived idleEnabled flag, so Stay Awake still toggles correctly while media is inhibiting.

Idle browsing with Firefox open is unchanged. You only skip the screensaver while media is actually playing.

Why not the other open PRs

Test

  • bash test/shell.d/idle-test.sh — player matching, idleEnabled gating, and QML wiring.
  • ./test/shell — idle file green. The same three omarchy-pkgs-checkout failures as on quattro (config-test.sh, snapper-test.sh, unowned-system-paths-test.sh); launch-about-test.sh, runtime-smoke-test.sh, and theme-install-guards-test.sh also fail here on unmodified quattro (no compositor animation / live IPC / network).

Live check on this machine: with Plex playing in windowed Firefox, idle status reports mediaInhibiting: true and the screensaver no longer starts.

The idle service only honors Wayland inhibitors. Firefox, Zen, and
LibreWolf request inhibit over D-Bus, which nothing owns since hypridle
was replaced, so the screensaver fires over playing video.

Watch those browsers' MPRIS Playing state and hold idle off for the
duration of playback. Fullscreen windows also get a Hyprland idle_inhibit
rule for videos that never publish MPRIS.
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at head 8456d0de, by reading only. Nothing was run on a worker, because this is one of several open fixes for the same bug, and the maintainer should merge only one of them for Firefox.

The bug is real, and #6475 tracks it: Firefox, Zen and LibreWolf ask for idle inhibit through the portal, and on quattro the shell's IdleMonitor only honours Wayland inhibitors. Other open fixes for it:

On the same cause, #7877 is the better fix for Firefox. It adds a single environment variable, while this PR puts 174 lines of player-name matching for one browser family into the idle service. The difference this PR names in its description is real in principle: Firefox attaches its Wayland inhibitor to the focused window, and Hyprland honours an inhibitor only while that window is visible. Playback started in an unfocused window, or left running on another workspace, may not hold idle off under #7877. That has not been reproduced here. If the maintainer wants that case covered, the D-Bus service in #13359 covers it for every app, not just Firefox.

Reading this PR's code, I found no defect. The idle toggle change to setIdleEnabled(root.stayAwake) is needed and correct: idleEnabled now also goes false during playback, and the old !idleEnabled would have turned Stay Awake off when a user meant to turn it on.

No second opinion this time: the reviewer (Codex Medium) answered a ping, but today's review budget was spent, so this reading is one model's (Claude Opus 5.5). This is waiting on the maintainer to choose between the fixes; nothing is needed from the author.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

2 participants