Glad I could help! just a quick note if u used the config and in the future had problems with screen sharing for example chromecast screen or web to tv try to disable wlr portal. I didnt have the time to test it with wlr enabled. goodluck!
My only screen shank scenario is simply zoom. Ha ha ha but thank you so much for the heads up.
As I understand the portals, from reading various docs. For hyprland on NixOS the portals should be xdg-desktop-portal-gtk
and xdg-desktop-portal-hyprland
.
xdg-desktop-portal-hyprland
is a fork of xdg-desktop-portal-wlr
. Iād still expect partial functionality with wlr.
The only real documentation is on the Arch linux wiki (but of course) and this useful fact buried in there:
When a request is made,
xdg-desktop-portal
will use theXDG_CURRENT_DESKTOP
environment variable to determine which backend it will use for the request. If more than one backend can be used for the current desktop, the first one in alphabetical order is chosen. If no backend for the current desktop can handle the interface, no backend is available for the current desktop, orxdg-desktop-portal
canāt determine the current desktop, then it will choose the first portal in alphabetical order between all of the installed portals that support the requested interface.
( XDG Desktop Portal - ArchWiki )
Which explained to me how having both installed worked at all.
For me, xdg-open is not working, and having xdg-utils installed does not do the trick.
I sniffed around the nixpkgs patches for xdg-utils a bit, and it turns out in unstable, it patches xdg-utils such that it unconditionally sets the DE to āflatpakā when
NIXOS_XDG_OPEN_USE_PORTAL=1
for me this broke xdg-open completely, always complaining that there was no application found. Unsetting NIXOS_XDG_OPEN_USE_PORTAL fixed it for me, but now Iām wondering if this is the right choice moving forward.
Could I fix the flatpak route for xdg-open instead in my config perhaps? I forked @nomadics nix config here: GitHub - Arroquw/nixos-config: My NixOS Flake + dotfiles
the flatpak route calls this command:
gdbus call --session --dest org.freedesktop.portal.Desktop --object-path /org/freedesktop/portal/desktop --method org.freedesktop.portal.OpenURI.OpenURI --timeout 5 "" "https://google.com" {}
(I added google.com as simple test). For me, this prints
(objectpath '/org/freedesktop/portal/desktop/request/1_578/t',)
and then the screen with āno application foundā pops up.
So, unset NIXOS_XDG_OPEN_USE_PORTAL, or fix it in a different way? It does seem to work fine with my DE set to gnome (even though I donāt have gnome installed, though I do have gio), while using hyprland.
Sorry for the delete and double post, I was jumping to the wrong conclusions.
Iām running into this issue: Flatpak apps can't launch the default browser Ā· Issue #189851 Ā· NixOS/nixpkgs Ā· GitHub
Simply running
systemctl --user import-enviroment PATH
Fixes it for me. I guess I will watch the github issue, and in the meantime run this command in my hyprland.conf or something like that.
Adding this to Hyprland init script solved the issue for me:
exec systemctl --user import-environment PATH && \
systemctl --user restart xdg-desktop-portal.service
With your help @justinvson-pd and this blogpost i was able to solve it with
xdg.portal.config.common.default = [ "*" ];
in the nixos-config
EDIT: After a bit of trial and error i found a more fine-grained solution:
xdg.portal.config.common.default = [ "gnome" ];
As @brnix mentioned installing xdg-utils instantly resolved my exact issue using hyprland aswell, real lifesaver.