How to change the file icon?

This ‘go.mod’ has an audio file icon and its property description is also an audio file.



“mod” files are classified as music files. Nautilus, like most tools, uses the extension to determine the file type, and only resorts to “sniffing” the content if the result is uncertain.

If the file empty?

GNOME relies on MIME type to display file icon:

In case want to create a dock/desktop launcher for a specific file:

1 Like

No. It has two lines of text in it.

So, it seems like Nautilus should have sniffed that out and set the proper file icon ?

Will a Fedora solution work on Ubuntu ?

Here we go

Yep, it matches the glob pattern:

It should work in general, there’s nothing Fedora-specific.
You just need to override the glob pattern with another MIME type.

Can you rename the file? I mean: you are hijacking the extension, and the shared-mime-database (which is the specification used by Nautilus) does not have other entries for files with extension “mod”.

It is artefact of a certain popular programming language:

Maybe we could add go.mod and go.sum filename to shared-mime-info as text/plain or something.

Edit: here is the source if someone wants to open a merge request:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.