uninstall snap and install deb package
This seems to have worked for me – thanks for the idea!
uninstall snap and install deb package
This seems to have worked for me – thanks for the idea!
although, of course, this doesn’t solve the problem for Obsidian snap…
@rgamber, your solution worked for me with Obsidian Snap (version 47)!
First I had to confirm that my firefox desktop file was in fact called “firefox_firefox.desktop”: I ran xdg-mime query default text/html and it returned firefox_firefox.desktop.
Then I ran your commands:
xdg-mime default firefox_firefox.desktop x-scheme-handler/http
xdg-mime default firefox_firefox.desktop x-scheme-handler/https
Then I linked my mimeapps.list to obsidian’s with ln -s ~/.config/mimeapps.list ~/snap/obsidian/47/.local/share/applications/mimeapps.list.
After these changes, Obsidian started opening applications in the correct program. I confirmed this by running the following on the Obsidian console (accessible by pressing Ctrl + Shift + I in Obsidian):
var execSync = require('child_process').execSync;
cmd="xdg-open https://test.com"
console.log(execSync(cmd, {encoding: "utf-8"}))
This returned “undefined” in the console and separately opened “test.com” in my Firefox window, as I hoped.
I confirmed that this still worked even after I undid all other changes (removing extra lines in /usr/local/bin/xdg-open to leave only the line exec /usr/bin/xdg-open "$@", removing other symlinks of mimeapps.list, etc.).
I appreciate your effort towards a fix.
Unfortunately this did not work for me and I reinstalled my Obsidian Snap in order to fix anything I may have messed in creating symlinks (my mimeapps.list file was in the share folder above applications, fwiw).
Hoping for a fix for the developer supported Snap on this issue. I don’t want to sound like a classic entitled Linux user but I have been dealing with this issue for nearly a year since I started using Obsidian. I appreciate the excellent functionality that exists outside of this one issue for me.
tldr; The root cause of this bug is that Obsidian (the snap version) is overriding the XDG_CONFIG_HOME environment variable for some reason.
Here are some debugging tips, and what I found out after doing some troubleshooting myself:
If you want to open a shell within the sandbox of the Obsidian snap package, run:
snap run --shell obsidian
From there, you will be in a new shell with Obsidian’s sandbox and environment. Run exit to exit. You can run these commands to see the default browser values in that sandbox:
gio mime x-scheme-handler/http
gio mime x-scheme-handler/https
xdg-mime query default x-scheme-handler/http
xdg-mime query default x-scheme-handler/https
ls -l /usr/bin/x-www-browser /etc/alternatives/x-www-browser
I think gio mime and xdg-mime use the same configuration backend (mimeapps.list), if I am not mistaken, but it is worth checking both.
The Arch wiki page on default handlers is good reading.
It’s also worth running env | grep '^XDG_' | sort to see what the XDG environment variables are, in particular, XDG_DATA_DIRS, XDG_DATA_HOME and XDG_CONFIG_HOME. On my machine, there are:
$ env | grep '^XDG_' | sort
XDG_DATA_DIRS=/home/flimm/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
# ...
When run inside the Obsidian Snap sandbox, I get similar results:
$ snap run --shell obsidian
$$ env | grep '^XDG_' | sort
XDG_DATA_DIRS=/home/flimm/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
However, when I open the console tab in Obsidian, using ctrl-shift-i, and I run this JavaScript, I notice that the environment variables have changed:
> var execSync = require('child_process').execSync;
> console.log(execSync("env | grep '^XDG_' | sort", {encoding: 'utf-8'}))
XDG_CACHE_HOME=/home/flimm/snap/obsidian/common/.cache
XDG_CONFIG_HOME=/home/flimm/snap/obsidian/47/.config
XDG_DATA_DIRS=/home/flimm/snap/obsidian/47/.local/share:/home/flimm/snap/obsidian/47:/snap/obsidian/47/data-dir:/home/flimm/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
XDG_DATA_HOME=/home/flimm/snap/obsidian/47/.local/share
The environment variable XDG_CONFIG_HOME is usually unset, but now it is set to /home/flimm/snap/obsidian/47/.config. I think this is causing xdg-open http://example.com to look for mimeapps.list within ~/snap/obsidian/47/.config/ and nowhere else, instead of the default location ~/.config. This explains why running ln -s ~/.config/mimeapps.list ~/snap/obsidian/current/.config/mimeapps.list is fixing the issue for people. (current is a symlink to the current version of Obsidian).
I wonder why this environment variable is being modified, and what is modifying it.
I think this is a bug in Obsidian (the snap version). This seems to be confirmed by this quote in the Snapcraft forums:
The obsidian snap appears to be a classic confined snap, so issues with it are likely to be different to strict confined snaps as they run in very different environments (there is no sandboxing for classic).
Using environment variables to control behaviour of classic confined snaps is known to cause problems if it goes on to execute programs not belonging to the snap. This is one of the reasons for all the code in Snapcraft set up to help classic snaps use use
DT_RPATHto find libraries rather than theLD_LIBRARY_PATHenvironment variable.So the fix here would be for obsidian to figure out how to do what it needs to without overriding those
XDG_*environment variables.
I am using the AppImage on Ubuntu 24.04 with the Settings app as well as xdg-settings get default-web-browser all reporting Firefox as my default browser. Yet, Obsidian was opening a new process of Chromium. After executing the suggested commands, Obsidian opens Firefox, as desired. Thanks!
This fixed the problem for me, Ubuntu 25 and obsidian appImage
I used this reply to construct a solution that seems to work. NOTE: the first 5 steps maybe could just be substituted with running a shell with export XDG_CONFIG_HOME=$HOME/snap/obsidian/current/.config, but I haven’t tried that so reporting all my steps for completeness.
var execSync = require('child_process').execSync;
console.log(execSync("env | grep '^XDG_' | sort", {encoding: 'utf-8'}))
export before all of the variables you copied (ie. export XDG_CACHE_HOME=…).xdg-mime default firefox_firefox.desktop x-scheme-handler/http
xdg-mime default firefox_firefox.desktop x-scheme-handler/https
I’m not sure what changed, but I’m here to report that all of a sudden this issue is resolved for me. Clicking a link in Obsidian (snap) opens it in Firefox (snap).
Negative here, no change. I went so far as to purge the snap and reinstall, and I am on 1.11.5. It opens links in Firefox, but my default browser is Chrome.
Still having this issue with Obsidian 1.11.7 (snap) on Ubuntu 24.04.4 LTS. My guess is that the snap isn’t using the snapcraft xdg-desktop-portal because of how it’s being packaged.
Still having this issue with Obsidian 1.12.4 (snap) on Ubuntu 24.04.4 LTS.
This issue also affects the ability to delete files. “Delete”d files are moved into the sandbox (see ~/snap/obsidian/current/.local/share/Trash/) instead of the “system trash”. This is because the XDG Desktop Portal (org.freedesktop.portal.Trash) is needed to access the “system trash“ from inside the snap sandbox.
Still having this issue with Obsidian 1.12.4 (snap) on Ubuntu 24.04.2 LTS
Also seeing this same issue. Submitted a bug and it was rerouted to this thread. Using Obsidian via Snap image on Ubuntu GNOME. Will likely swap to .deb version now.
This is still the case 3 years later in 2026.