Desktop, X11 & Wayland

Files or links open in the wrong default application

MIME defaults and desktop-specific overrides can select an unexpected application. Compare detected type, handler ID and configuration precedence.

On this page
  1. Symptoms & scope
  2. Possible causes
  3. Diagnose safely
  4. Evidence-guided next steps
  5. References & review
  6. Related problems

Symptoms & scope

  • PDF files open in a different viewer than expected.
  • A web link launches an old browser despite a newer install.

Relevant environment

freedesktop.org MIME application associations; file types and URL scheme handlers are separate identifiers.

Possible causes

These are possible explanations, not a confirmed diagnosis. Several independent faults can coexist.

  • A higher-priority user or desktop-specific mimeapps.list may override a system default.
  • The application may use a different MIME type or URL-scheme association.

Diagnose safely

Run one command at a time in the relevant session. Read the explanation first. Uppercase placeholders need your own values; tools and privileges vary by distribution. These commands are displayed here and never executed by the website.

Check 1

Replace with a representative existing file; classifies it without opening an associated GUI application.

xdg-mime query filetype /path/to/file

Interpret the result: Use the reported type for the next query. A filename extension alone does not establish the MIME type used by the desktop.

Check 2

Replace MIME_TYPE with the reported type, such as application/pdf, or the actual URL scheme, such as x-scheme-handler/https.

xdg-mime query default MIME_TYPE

Interpret the result: The output is a desktop-file ID, not an executable path. Empty output suggests no resolved default; another app may still choose its own handler.

Evidence-guided next steps

Set the default for the actual MIME type

If the resolved default is wrong, record its desktop-file ID and choose the intended installed application through the desktop’s default-app settings or xdg-mime default APP.desktop MIME_TYPE. Change the HTTPS scheme separately when the issue concerns web links.

Precautions: Use a real installed desktop-file ID. Do not bind every file type to a single application.

Recovery / rollback: Restore the recorded desktop-file ID for the same MIME type, or restore the saved mimeapps.list if there was previously no explicit association.

Did this solution help you?

Share this solution#

Correct a stale higher-priority association

If the new default is immediately shadowed, inspect the active desktop’s user mimeapps.list and desktop-specific overrides. Back up the owning file and remove only the stale Default Applications entry for that type, preserving Added and Removed Associations.

Precautions: Configuration locations have precedence; editing a low-priority system file may have no effect on a user override.

Recovery / rollback: Restore the saved association file or original entry for this type, without replacing unrelated defaults.

Did this solution help you?

Share this solution#

References & review

This guide was prepared from primary project or distribution sources and reviewed on the date shown. This is an editorial source check, not evidence that a fix was reproduced on your hardware. Diagnostic log examples are synthetic fixtures. Version-dependent details must be checked against your installed release.