code icon indicating copy to clipboard operation
code copied to clipboard

Move inode/directory mimetype association to another .desktop file and context menu in Files

Open quequotion opened this issue 5 years ago • 2 comments

This causes a conflict when another application, even a preferred application, also uses the inode/directory association, such as Files.

I took note that Terminal, which also opens folders, does not cause this conflict. Terminal uses a secondary .desktop file to associate inode/directory with the flag NoDisplay=true, which then appears in File's context menu under "Open in.." (via its contractor plugin).

I think Code should take the same approach. Use a separate, NoDisplay=true .desktop for the inode/directory association, let Files' context menu do the heavy lifting.

quequotion avatar Aug 09 '20 00:08 quequotion

As noted in #857, I found the cause of this to be when update-desktop-database generates mimeinfo.cache, it lists all .desktop files with a particular mime association, in this case inode/directory, in alphanumerical order.

Therefore io.elementary.code.desktop's association overrides io.elementary.files.desktop's association.

The solution is to relocate the association to a separate .desktop file with a name that comes after Files' .desktop, such as open-pantheon-code-here.desktop; as is done in Terminal.

Here's a video to illustrate.

quequotion avatar Aug 26 '20 12:08 quequotion

This may be a candidate for the Distro-agnostic Pantheon project.

As @davidmhewitt and @jeremypw, and I have noted, "open-application-here.desktop" is not a full-proof solution: in theory, a user of Code may have a file manager with a .desktop filename still coming after it in alphanumerical order (nautilus, thunar, etc). Rather than relying on vendor-supplied mime defaults that may not be available in another distribution, we need to find a solution that is more universal to specify the order of mime associations.

quequotion avatar May 22 '21 08:05 quequotion