How to change the default program for a chosen file type system-wide in kde or xfce?

23,613

Have a look at the file $HOME/.local/share/applications/defaults.list

There is a section [Default Applications] to specify the programs for particular mime types. You can add for example:

application/x-debian-package=gdebi.desktop

The .desktop files can be found in /usr/share/applications/ or you can create your own files under $HOME/.local/share/applications/. To find out the mime type of the files, run

file --mime-type <some_file>

Alternatively, in KDE one can accomplish the same in GUI in File Associations inside System Settings.


To register a MIME type for an extension see freedesktop.org - AddingMIMETutor and stackoverflow - Register file extensions / mime types in Linux.

Share:
23,613

Related videos on Youtube

igor012
Author by

igor012

Updated on September 18, 2022

Comments

  • igor012
    igor012 almost 2 years

    I would like to have files of a chosen type (by their extension) to open with some specific programs. Which configuration files do I need to edit?
    I've tried some in /usr/share/appplications/default.list but it doesn't work.

  • igor012
    igor012 about 12 years
    I have modified the mime type `MimeType=image/x-exr;image/tiff;image/png;image/jpeg;image/‌​dpx;' in the .desktop file.
  • Anatoly Agapito
    Anatoly Agapito almost 11 years
    On my version Fedora release 18 (Spherical Cow) running xfce, the file was named mimeapps.list, not defaults.list. JTYSK
  • appas
    appas about 9 years
    This can be used to set the application based on MIME type, but what about file extension (as per the original question)? For instance, Processing sketches have the MIME type text/plain ("plain text document"), but they can be told apart by their .pde extension. I'd like to set them to open in Processing, but have not been able to do so without affecting .txt's and others as well.
  • Marco
    Marco about 9 years
    @appas First you register the file extension to a MIME type. Then you assign an application to the MIME type as depicted in this answer.
  • Edward
    Edward over 6 years
    You can also find the custom "Open with" .desktop (Desktop Entry) files in this local applications folder - they're automatically created here. Some of the options inside the file can be edited with the "File Properties" GUI from the file manager.