diff --git a/home/linux/gui/hyprland/values/xdg.nix b/home/linux/gui/hyprland/values/xdg.nix new file mode 100644 index 00000000..9e7b40b6 --- /dev/null +++ b/home/linux/gui/hyprland/values/xdg.nix @@ -0,0 +1,33 @@ +{pkgs, ...}: { + xdg.portal = { + enable = true; + + config = { + common = { + # Use xdg-desktop-portal-gtk for every portal interface... + default = [ + "gtk" + "hyprland" + ]; + # except for the secret portal, which is handled by gnome-keyring + "org.freedesktop.impl.portal.Secret" = [ + "gnome-keyring" + ]; + }; + }; + + # Sets environment variable NIXOS_XDG_OPEN_USE_PORTAL to 1 + # This will make xdg-open use the portal to open programs, + # which resolves bugs involving programs opening inside FHS envs or with unexpected env vars set from wrappers. + # xdg-open is used by almost all programs to open a unknown file/uri + # alacritty as an example, it use xdg-open as default, but you can also custom this behavior + # and vscode has open like `External Uri Openers` + xdgOpenUsePortal = true; + # ls /etc/profiles/per-user/ryan/share/xdg-desktop-portal/portals + extraPortals = with pkgs; [ + xdg-desktop-portal-gtk # for provides file picker / OpenURI + # xdg-desktop-portal-wlr + xdg-desktop-portal-hyprland # for Hyprland + ]; + }; +} diff --git a/modules/nixos/desktop.nix b/modules/nixos/desktop.nix index c81783c1..bb6afff3 100644 --- a/modules/nixos/desktop.nix +++ b/modules/nixos/desktop.nix @@ -30,14 +30,6 @@ in { #################################################################### # NixOS's Configuration for Wayland based Window Manager #################################################################### - xdg.portal = { - enable = true; - wlr.enable = true; - extraPortals = with pkgs; [ - xdg-desktop-portal-wlr - ]; - }; - services = { xserver.enable = false; # disable xorg server # https://wiki.archlinux.org/title/Greetd diff --git a/modules/nixos/desktop/graphic.nix b/modules/nixos/desktop/graphic.nix index ef107c8a..77be0f35 100644 --- a/modules/nixos/desktop/graphic.nix +++ b/modules/nixos/desktop/graphic.nix @@ -21,10 +21,11 @@ # xdg-open is used by almost all programs to open a unknown file/uri # alacritty as an example, it use xdg-open as default, but you can also custom this behavior # and vscode has open like `External Uri Openers` - xdgOpenUsePortal = false; + xdgOpenUsePortal = true; + + # ls /run/current-system/sw/share/xdg-desktop-portal/portals/ extraPortals = with pkgs; [ - xdg-desktop-portal-gtk # for gtk - # xdg-desktop-portal-kde # for kde + xdg-desktop-portal-gtk # for provides file picker / OpenURI ]; }; }