Firefox idle-inhibit #1503
Replies: 2 comments 4 replies
-
Nice research! Thanks for sharing, Edit: Edit 2: |
Beta Was this translation helpful? Give feedback.
-
Good news, |
Beta Was this translation helpful? Give feedback.
-
I've set up
swayidle
on my system for screen locking and suspending. When watching a video withfirefox
, my screen still gets locked. The only work around I found was to actively inhibit idleness, e.g. using the corresponding way bar button. After spending some time I found the reason why inhibiting idleness isn't working infirefox
, I'm posting this here so others don't have to dig into this rabbit hole.Bottom line is that this come down to
xdg-desktop-portal
configuration and an outstanding issue inxdg-desktop-portal
, the solution is very likely flatpak/xdg-desktop-portal#1255So
firefox
has multiple lock (inhibit) mechanisms implemented in a fixed order. This can be observed withMOZ_LOG="LinuxWakeLock:5" firefox
and starting a video in the browser. It tries the first way to lock, if locking fails, it tries the next mechanism until it finds a call that succeeds. Unfortunately it tries theGnome
way before attempting to use Waylandidle-inhibit
. The Gnome way is to use adbus
interface to prevent screensaver etc to kick-in. Even when running labwc/a wlroots based compositor, that dbus interface is exposed by xdg-desktop-portal. Not in thewlr
interfaces (configured inwlr.portal
), which are only about screen casting, but in thegtk
fallback interfaces.According to the xdg-desktop-portal manual (
man portals.conf
), disabling an interface is possible usingnone
as interface value. So the solution should be to create a.config/xdg-desktop-portal/wlroots-portals.conf
file containingThis is just a copy from
/usr/share/xdg-desktop-portal/wlroots-portals.conf
with additionally disabling the inhibit interface. Try/usr/libexec/xdg-desktop-portal -v
to validate.This should work, but it doesn't :( The reason is that the
none
specifier is broken inxdg-desktop-portal
. An issue has been made here flatpak/xdg-desktop-portal#1254 and there is even an open pull request flatpak/xdg-desktop-portal#1255 .Whatever I tried on my machine, the current fallback mechanism in xdg-desktop-portal always found a way to expose the gtk inhibit interface. So unfortunately this needs to get fixed in xdg-desktop-portal first. Furthermore I think the default
wlroots-portals.conf
should also containorg.freedesktop.impl.portal.Inhibit=none
since exposing that interface on a wlroots based compositor is imho useless.Anyway, long story, thanks for reading. I hope this PR gets merged in the near future and at least I learned a lot about the complexity of
idle-inhibit
.Edit: The
xdg-portal-desktop
behavior has been fixed in https://github.com/flatpak/xdg-desktop-portal/releases/tag/1.18.4PS: All file locations are for a standard Fedora installation. Other distributions might use different locations.
Beta Was this translation helpful? Give feedback.
All reactions