From a7c2804aa96efff423181603911a27f504e72f93 Mon Sep 17 00:00:00 2001 From: teutat3s <10206665+teutat3s@users.noreply.github.com> Date: Tue, 15 Oct 2024 15:24:04 +0200 Subject: [PATCH] nixos/sway: workaround idle inhibit not working in Firefox Source: https://www.reddit.com/r/swaywm/comments/1dqud2a/how_to_get_firefox_to_inhibit_idle_when_watching/ > Firefox supports the Wayaland inhibit protocol, but it attempts to use the DBus interfaces first. However, the gtk portal has an issue where it returns success even though the wlr portal/sway doesn't have an implementation for the inhibit method, see #465. (cherry picked from commit 7e7a06994fe41ce961755bb98e168e5c4dd630d4) --- nixos/modules/programs/wayland/sway.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/nixos/modules/programs/wayland/sway.nix b/nixos/modules/programs/wayland/sway.nix index e3e32aa7a56ab..2cb5c3abfe325 100644 --- a/nixos/modules/programs/wayland/sway.nix +++ b/nixos/modules/programs/wayland/sway.nix @@ -135,7 +135,19 @@ in services.displayManager.sessionPackages = lib.optional (cfg.package != null) cfg.package; # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050913 - xdg.portal.config.sway.default = lib.mkDefault [ "wlr" "gtk" ]; + # https://github.com/emersion/xdg-desktop-portal-wlr/blob/master/contrib/wlroots-portals.conf + # https://github.com/emersion/xdg-desktop-portal-wlr/pull/315 + xdg.portal.config.sway = { + # Use xdg-desktop-portal-gtk for every portal interface... + default = "gtk"; + # ... except for the ScreenCast, Screenshot and Secret + "org.freedesktop.impl.portal.ScreenCast" = "wlr"; + "org.freedesktop.impl.portal.Screenshot" = "wlr"; + # ignore inhibit bc gtk portal always returns as success, + # despite sway/the wlr portal not having an implementation, + # stopping firefox from using wayland idle-inhibit + "org.freedesktop.impl.portal.Inhibit" = "none"; + }; } (import ./wayland-session.nix {