(Left) Clicking on the trash can in Plank, or right clicking on it and selecting "Open Trash" opens Code--the text editor--instead of Files.

My first thought was to check if any nonsense associations had been made in ~/.local/share/applications/mimeinfo.cache or ~/.config/mimeapps.list, but all I found was application/octet-stream=io.elementary.code.desktop; in the latter--which I removed.

As expected, this changed nothing (application/octet-stream is the mimetype for binary data; the trash icon in plank opens a folder, which has the mimetype inode/directory).*

Maybe Code is overriding Files' association to open folders (inode/directory)?

Installed software versions:

pantheon-code 3.4.1-1
pantheon-files 4.4.3-1
plank 0.11.89-2

*Off topic: It is very common to find that some application has been nonsensically associated with application/octet-stream. Basically, this happens every time you open the wrong type of file in some application (although, technically, it should only happen when you open a binary file in an application). Despite that you may even have unchecked the option to "Set this as default" when you made this mistake--perhaps knowing it was probably the wrong application for that file--this is always set as default. The only way to unset this is to edit either mimeinfo.cache or mimeapps.list and remove the nonsense association. I have done this countless times and I am wondering when, if ever, linux desktops will cease to inflict this suffering on their users.

1 Answer 1


Maybe Code is overriding Files' association to open folders (inode/directory)?

Yes, that is the case. Both have an association with inode/directory in their .desktop file. Somehow Code's association gets priority (my guess is either it goes to the most recently updated application or the one with the name in the earliest alphanumerical order).

This can be demonstrated by uninstalling Code, and observing that the trash can in Plank resumes opening Files to view the Trash folder; then reinstalling Code and observing that the trash can in Plank again opens Code.

To work around the problem, remove the inode/directory; association from Code's .desktop file, and update the mimetype cache:

Find this line in /usr/share/applications/io.elementary.code.desktop:


Change it to:


Then run (SUID):

# update-desktop-database

Note that subsequent upgrades of Code will undo this fix (unless I can convince upstream to remove the association).

To keep it, copy the edited .desktop file for Code to ~/.local/share/applications/io.elementary.code.desktop, creating an override:

cp {/usr,~/.local}/share/applications/io.elementary.code.desktop

To select Code from Files' "Open in.." context menu, you need a secondary--masked--.desktop file:


See it in action here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.