Setting Thunar as Default File Manager
Published: 2020-12-28 | Last Updated: 2021-02-02 | ~3 Minute Read
I’ve recently updated to Slackware current due to some issues I was facing with my dual monitor setup. I upgraded my graphics card to an AMD GPU and the video drivers were not playing nice on Slackware 14.2. I had been toying with the idea of switching to the current branch of Slackware for some time but had always been reluctant due to the “high maintenance” required.
With the above issue not letting me use my dual monitor setup, I was “forced” to upgrade to Slackware current. I’ve been having a great time with it, and have already learnt a few things about the booting process. But today I wanted to do a quick write up about one of the specific issues that I’ve experienced while using both Slackware 14.2 and Slackware current but addressed until now.
Every time I would try to open a download in Firefox by going to “Open Containing Folder” from the Firefox UI, an application other than what I wanted for my file manager opened up. In Slackware 14.2 it was something completely unrelated to files, on Slackware current it was EasyTAG.
This made it difficult to use features from programs like Firefox where a file manager was expected to open up when clicking on a certain section of the UI.
I took to the web to find out why this was happening, I was pretty sure that this was occurring due to my using the i3 window manager instead of a desktop environment like XFCE. I didn’t have this type of odd behavior on desktop environments like XFCE and KDE, and in case it did happen they probably have built in mechanisms to select your default applications.
So I found out how it is that the programs are invoked while using i3, it’s done via the xdg-utils package. This package has the xdg-open command which is used to open all sorts of applications when clicking on different UI elements from other programs such as Firefox.
I had come across
xdg-open in the past and use it in my i3 config file but this time I needed to to a bit more digging into how it works in order to fix this particular issue.
I then found that I needed to supply a desktop entry for the application that I wanted to use. More information in general about the use of MIME Applications in XDG can be found here.
With all of the above done I then looked at how to check what program was in use and what I needed to change in order to let the system know what I actually wanted. It wasn’t as straight forward as I would have expected (not because it’s actually complex to setup up, but rather because I didn’t find a single source that explained this in a way that made sense to me) but this post by Martin Scharm provided a lot of insight into what was expected by the XDG configuration file and how to find things in my own system, since it seemed from my research like different distros may use different paths to configure XDG in general.
In order to check what was being currently used in my system I ran:
$ xdg-mime query default inode/directory easytag.desktop
Since I knew I had Thunar installed I confirmed the .desktop file existence in
/usr/share/applications and found that it was
thunar.desktop. I then updated the
~/.config/mimeapps.list file and added the following line to the
[Default Applications] section:
Once that was done, I ran the query command again and was able to see the updated information:
$ xdg-mime query default inode/directory thunar.desktop
With that Thunar now opens as my default file manager whenever I click on buttons from other applications that launch a file manager.
This same process can apply to any other application that you may want to setup as a default app for anything else on your system, like text files for example.