Cannot Change Default File Association in GNOME 43+

Linux & Unix Intermediate 👁 13 views 📅 Jun 16, 2026

You try to right-click a .md file, pick Open With, but GNOME ignores your choice and keeps using the old app. Happens after setting it via UI or mimeopen.

You're running GNOME 43 or newer on Fedora 38 or Ubuntu 23.04. You right-click a Markdown file, pick Open With, select Typora or Obsidian, tick Always use this application, and click OK. Next time you double-click the same .md file, it still opens in gedit. Or maybe you used mimeopen -d file.md in the terminal, selected the right app from the list, and it still doesn't stick.

What's actually happening here is that GNOME reads the default application from two places: the user's local MIME database at ~/.config/mimeapps.list and a system-level override at /usr/share/applications/mimeapps.list. The UI and mimeopen both write to the user file, but they sometimes write the wrong entry format. Specifically, they write the app's full path or its display name instead of the desktop file name (like typora.desktop). GNOME's MIME handler only recognizes entries in application/extension=app.desktop format. When it sees an unrecognized value, it ignores the line and falls back to the system default — which is whatever gnome-text-editor.desktop or org.gnome.gedit.desktop says.

The other common cause is that a flatpak or snap version of the app installed a separate MIME override in ~/.local/share/applications/mimeapps.list or a per-user override in ~/.config/mimeapps.list that's malformed. GNOME reads these in priority order and stops at the first match, even if that match is broken.

Fix It — Manual Override

Skip the UI. The real fix is to edit the MIME database directly with xdg-mime and verify the entry with gio mime. Here's the exact sequence:

  1. Find the desktop file name for your target app. For Typora, it's typora.desktop. For Obsidian, obsidian.desktop. For VS Code, code.desktop. Check /usr/share/applications/ or ~/.local/share/applications/ for the exact name. Case matters.

  2. Run this command, replacing text/markdown with your MIME type and typora.desktop with the correct desktop file:

    xdg-mime default typora.desktop text/markdown

    This writes the correct line to ~/.config/mimeapps.list in the format text/markdown=typora.desktop. No path prefixes allowed.

  3. Verify it took effect:

    gio mime text/markdown

    It should return typora.desktop. If it returns gnome-text-editor.desktop or something else, step 2 didn't write correctly — check your desktop file name again.

  4. Test by double-clicking a .md file in Nautilus. Should open in Typora now.

If It Still Fails

Check ~/.config/mimeapps.list and ~/.local/share/applications/mimeapps.list for duplicate entries or lines that don't end in .desktop. You'll sometimes see garbage like text/markdown=/usr/bin/typora or text/markdown=Typora. Delete those lines, keep only the correct app.desktop entry. Then log out and back in or run update-desktop-database ~/.local/share/applications.

If you're using a flatpak version of the app, the desktop file is inside /var/lib/flatpak/exports/share/applications/ or ~/.local/share/flatpak/exports/share/applications/. The name will be something like com.typora.Typora.desktop. Use that full name in xdg-mime default. Flatpak apps often install their own MIME overrides in ~/.local/share/flatpak/exports/share/applications/mimeapps.list — that file takes priority over ~/.config/mimeapps.list. If it exists, you need to edit it directly or remove it to let your user-level setting win.

Another subtlety: if you have defaults.list in ~/.local/share/applications/ (an older freedesktop spec file), GNOME reads that before mimeapps.list. Remove defaults.list if it exists — it's deprecated and causes conflicts.

Still broken? Check that the app's .desktop file has a MimeType= line listing the MIME type you're trying to associate. If it doesn't, GNOME won't offer it as an option, and xdg-mime default will silently fail. You can add the MIME type to the desktop file manually and run update-desktop-database.

Was this solution helpful?