>>FIRST MISSION//LOGS//administration//changing-xserver-default-applications-using-xdg-tools.MD
[ + ] TARGET_LOCKED200 OK
SEP 04, 2018timer 3 MIN READSYS_TAG: administration STATUS: VERIFIED_WORKING

Changing Xserver Default Applications Using XDG Tools

ENGINE: KERNEL // STABLE
BASE_ARCH: x86_64
HOST: VASTORIGINS.COM
GPG: OKSIG_ID: 0x4EB27DB0

If you have ever double clicked a file on your Linux desktop and watched it open in the wrong application, you have already met the problem I want to solve today. It is one of those small annoyances that seems too trivial to search for, and yet it grinds on you every single time it happens. The good news is that the fix is built right into your system, and once you know how it works, you will never tolerate a wrong default again.

XDG (freedesktop.org), which stands for X Desktop Group, is a group which develops the X11 and xdg utilities that currently run as the barebones of Linux desktops. Almost every file that opens on your screen ends up there because of a decision made by these tools, from which image viewer handles your PNGs to which browser opens your links. So how do we change the defaults when opening a file on Xserver?

Be free, and live life fully.
~ Caroline Shaw.

🧰 So how do we configure XDG?

Tools that we will be using to configure xdg can be found in the xdg-utils package, which conveniently ships with basically every Linux distribution out there. The two utilities you will use the most are xdg-settings and xdg-mime. The first one handles the big picture defaults like your web browser and mail client, while the second is the fine-grained tool, mapping file types (or mime types) to the applications that should open them.

So, to set the default application to open a certain mime type, you need to run the code below:

xdg-mime default Thunar.desktop inode/directory

The command above adds the new mime application settings to ~/.local/share/applications/defaults.list, a plain text file that stores your personal associations. It tells xdg-mime to open a directory using Thunar, the XFCE file manager. If you prefer Nautilus, Dolphin, or even a terminal file manager, just swap out the application name and the format stays exactly the same. One command, and directories will never open in the wrong place again.

🎓 Fun Fact

While we are here, here is a little history on the group behind all of this:

  1. freedesktop.org (fd.o) is a project to work on interoperability and shared base technology for free-software desktop environments for the X Window System (X11) and Wayland on Linux and other Unix-like operating systems. It was founded by Havoc Pennington, a GNOME developer working for Red Hat in March 2000. The project’s servers are hosted by Portland State University, sponsored by Hewlett-Packard, Intel, and Google. ↩︎
[ SIGNATURE VERIFIED // GPG 0x4EB27DB0 // PROVENANCE SECURE ]
➔ RETURN TO LOGS