From 46cebeb8fd93f29814ce757bc8b9131b74ad9736 Mon Sep 17 00:00:00 2001 From: Daniel Fainberg Date: Tue, 7 Jul 2026 13:56:41 +0200 Subject: [PATCH] fix(desktop): add GTK portal so file dialogs work Home-manager's Hyprland module enables `xdg.portal` and pins the portal search dir to the user profile with only the Hyprland backend, which has no FileChooser implementation. File dialogs in Chromium/Electron apps (signal, brave) fail with a DBus "No such interface org.freedesktop.portal.FileChooser" error. Add `xdg-desktop-portal-gtk` at the home-manager layer (system-level extraPortals aren't in the pinned dir) and route FileChooser to it. Co-Authored-By: Claude Opus 4.8 --- modules/home.nix | 16 ++++++++++++++++ modules/nixos.nix | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/modules/home.nix b/modules/home.nix index a4b0891..3df407d 100644 --- a/modules/home.nix +++ b/modules/home.nix @@ -288,6 +288,22 @@ in gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; }; + # The home-manager Hyprland module below enables xdg.portal and pins the + # portal search dir (NIX_XDG_DESKTOP_PORTAL_DIR) to this user profile, adding + # only the Hyprland backend — which implements Screenshot/ScreenCast/ + # GlobalShortcuts but not FileChooser. Add the GTK portal here (system-level + # extraPortals aren't in the pinned dir, so they're never seen) and route + # FileChooser to it, else file dialogs in Chromium/Electron apps (signal, + # brave) fail with a DBus "No such interface + # org.freedesktop.portal.FileChooser" error. + xdg.portal = { + extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + config.common = { + default = [ "hyprland" "gtk" ]; + "org.freedesktop.impl.portal.FileChooser" = [ "gtk" ]; + }; + }; + wayland.windowManager.hyprland = { enable = true; configType = "hyprlang"; diff --git a/modules/nixos.nix b/modules/nixos.nix index babfb31..85d8006 100644 --- a/modules/nixos.nix +++ b/modules/nixos.nix @@ -96,7 +96,10 @@ # so the Secret Service is open without a second passphrase. security.pam.services.greetd.enableGnomeKeyring = true; - # XDG portals (screen sharing, file pickers, and so on). + # XDG portals (screen sharing, file pickers, and so on). The GTK portal (for + # file dialogs) is added at the home-manager layer, not here: home-manager's + # Hyprland module pins the portal search dir to the user profile, so a portal + # listed in this system-level extraPortals is never seen. See modules/home.nix. xdg.portal = { enable = true; extraPortals = [ pkgs.xdg-desktop-portal-hyprland ];