Open sedrubal opened 3 years ago
I'm not sure what the problem was and what fixed the problem but after a reboot it works again. Seems like something in my environment was broken.
I just found out that this problem is present when I'm running wayland. It was solved, because I switched to X11. I'm using plasma desktop
Any solutions for Sway on nixOS with every app in a Flatpak? I can't seem to open any links without copying and pasting into Firefox. I got the XDG portals for WLR and GTK.
This bug is probably to be reported to flatpak/xdg-desktop-portal
.
All xdg-open
does here is a dbus call to org.freedesktop.portal.Desktop
.
You can test this theory with a command like gdbus call -e -d org.freedesktop.portal.Desktop -o /org/freedesktop/portal/desktop -m org.freedesktop.portal.OpenURI.OpenURI '' 'https://example.org' {}
That doesn't work, I get an error saying there's no app installed.
What does gio mime x-scheme-handler/https
say (on the host)?
Default application for “x-scheme-handler/https”: org.mozilla.firefox.desktop
Registered applications:
org.mozilla.firefox.desktop
Recommended applications:
org.mozilla.firefox.desktop
I believe whatever is managing your session doesn't properly have XDG_DATA_DIRS
configured. It needs to include /var/lib/flatpak/exports/share
and $HOME/.local/share/flatpak/exports/share
.
So xdg-desktop-portal
is getting activated into an environment without these set and it fails to find your browser.
Could it be how nixOS sets up stuff? I ran printenv XDG_DATA_DIRS
and it shows this.
/nix/store/bv315gbg9m93ralhk6yiabc96n1a5c7i-sway-1.7/share:/nix/store/m0d6hi92gpw5g13z02cwdcp7r661cq7i-desktops/share:/home/ross/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/home/ross/.nix-profile/share:/etc/profiles/per-user/ross/share:/nix/var/nix/profiles/default/share:/run/current-system/sw/share
I'm not really familiar with it. The nixOS community may be helpful.
I found out that /home/ross/.local/share/flatpak/exports/share
does not exist for some reason.
If you've never used flatpak install --user
its probably not going to exist.
I never knew there was that option. I just copy the install command from Flathub.
Alright, I fixed it. I had to add in the /var/lib/flatpak/exports/share
path.
I've done some more digging into this issue and have determined that the XDG Desktop Portal isn't quite working as expected. I can't get it working to open links in Flatpaks when the portal is ran through the systemd user service. However, it works when I run it manually. Despite XDG_DATA_DIRS
being set to /nix/store/w5cq1n267dz0alzzmw60zv2pxarid67x-xdg-desktop-portal-1.14.4/share:/nix/store/wbsmj0d84l1r0qwr2cl2myzymqrw1hfk-gtk+3-3.24.34/share/gsettings-schemas/gtk+3-3.24.34:/nix/store/6vk1bk1pgvfl1jsm33p3ggzsln589v0m-gsettings-desktop-schemas-42.0/share/gsettings-schemas/gsettings-desktop-schemas-42.0:/var/lib/flatpak/exports/share:/nix/store/m0d6hi92gpw5g13z02cwdcp7r661cq7i-desktops/share:/home/ross/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/home/ross/.nix-profile/share:/etc/profiles/per-user/ross/share:/nix/var/nix/profiles/default/share:/run/current-system/sw/share
for the xdg-desktop-portal
. xdg-open
works when I trigger outside of Flatpaks but it fails from inside Flatpaks.
/var/lib/flatpak/exports/share/applications/mimeinfo.cache
contains the correct entries for Firefox:
application/vnd.mozilla.xul+xml=org.mozilla.firefox.desktop;
application/xhtml+xml=org.mozilla.firefox.desktop;
text/html=org.mozilla.firefox.desktop;
text/mml=org.mozilla.firefox.desktop;
text/xml=org.mozilla.firefox.desktop;
x-scheme-handler/http=org.mozilla.firefox.desktop;
x-scheme-handler/https=org.mozilla.firefox.desktop;
I tested with Discord as I know that uses links and found out some XDG_DATA_DIRS
doesn't exist. Specifically these two /run/host/user-share
and /run/host/share
.
I'm not super familiar with how the systemd environment gets set but flatpak
installs a handful of files such as /usr/lib/systemd/system-environment-generators/60-flatpak-system-only
and one of them must be expected to be picked up by systemd. I'm not sure how or if that gets to the xdg-desktop-portal
service, maybe there is supposed to be some dependency there.
@TingPing Yeah, nixOS doesn't have system-environment-generators
but it has user-environment-generators
. It doesn't have anything for Flatpak with systemd as far as I can tell.
Is there a way to force Obsidian and flatpak to be more verbose? I really want to troubleshoot it but it just doesn't provide enough information. I'm on Void Linux and this doesn't work for me either.
I'm not able to open links and files from inside flatpak contexts anymore. I have several apps that are able to open links (in my case Obsidian) or files (Zotero). I assume they use something like
xdg-open
. But nothing happens. When I click on links in Obsidian, I can see this when I useflatpak run ...
but nothing else happens:In Zotero I could open files before and a system dialogue was shown where I could choose an application. But nothing happens now.
Using
xdg-open <URL or file>
works as expected outside flatpak of course. I'm using Flatpak 1.11.1 on Archlinux.I'm very sorry to post such a vague issue and I'm sorry if this is off-topic, but I don't know, where I can find help instead.