You are not logged in.
None the electron apps I have (Discord, Slack, VSCode) are able to open any links in Firefox. It seems like other applications have no trouble with this.
$ xdg-settings get default-web-browser
firefox.desktop
$ xdg-open https://archlinux.org
// opens the page as expected
Any ideas why this might be happening? How would I troubleshoot this?
EDIT:
Changing the default browser with xdg-settings to chromium.desktop seems to work as expected. It does not work with firefox for some reason.
Last edited by Celsiuss (2021-03-30 15:36:54)
Offline
Looks like this is (at least in case) yet another buggy Wayland thing. I found a solution thanks to this thread.
cp /usr/share/applications/firefox.desktop ~/.local/share/applications/firefox-wayland-fix.desktop
Edit ~/.local/share/applications/firefox-wayland-fix.desktop and change the first Exec line to this:
Exec=env GDK_BACKEND=wayland /usr/lib/firefox/firefox %u
Then:
xdg-settings set default-web-browser firefox-wayland-fix.desktop
Offline
Sorry for the necrobump, I also had troubles opening links in Slack and this comes up as one of the first Google results. I had no success with the other solutions but I found what's going on in my case, hopefully this helps someone.
It turns out that when Electron tries to open a link, it uses xdg-open, but it launches it with file descriptors 1 (stdout) and 2 (stderr) not associated to anything - you can check this by looking around /proc/N/fd.
So after Firefox is launched, they get associated to something else ("random" devices, sockets) and when Firefox writes something to them, it can hang depending on various factors.
My workaround for this is to create a wrapper for xdg-open to set up stdout/stderr, i.e. create a file somewhere like /usr/local/bin/xdg-open (don't forget to chmod +x) with those contents:
#!/bin/sh
set -eu
# Electron apps do not set up stdout/stderr when launching links through
# xdg-open, which can cause Firefox & co. to hang, so set them up here.
[ -e /dev/fd/1 ] || exec 1>/dev/null
[ -e /dev/fd/2 ] || exec 2>/dev/null
exec /usr/bin/xdg-open "$@"
EDIT: The above problem is related to https://github.com/libuv/libuv/issues/2062. A simpler workaround is to launch the Electron program with stdout/stderr redirected to a file or /dev/null, e.g. like "slack >/dev/null 2>/dev/null".
Last edited by joanbrugueram (2022-08-31 23:32:00)
Offline
This should probably be in the wiki, https://wiki.archlinux.org/title/Xdg-utils#xdg-open
Online