1

In Nemo some "twig" files appear with the text icon whilst some appear with a web icon. I want all files with a "twig" extension to appear in Nemo like "html" files e.g. with a web icon. So I edited /etc/mime.types adding the "twig" extension to the html entry:

text/html                   html htm shtml twig

And then updated the MIME database using:

sudo update-mime-database /usr/share/mime

However it did not work, the twig files still have mixed icons.

I am running Linux Mint version 18.1.

0

Use freedesktop's unified system to define a new association.
Write a new source xml file e.g.

~/.local/share/mime/packages/text-twig.xml

with the following content:

<?xml version="1.0"?>
 <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
  <mime-type type="text/html">
    <comment>twig template files</comment>
    <glob pattern="*.twig"/>
  </mime-type>
 </mime-info>

then update your mime database

update-mime-database ~/.local/share/mime

and you're all set.


The above will alter *.twig files mime type for your current user. For a global change follow the same procedure replacing all occurrences of ~/.local with /usr

  • Is it possible to get a different icon rather than a "text file" icon in Nemo through this method? – tyebillion Apr 24 '17 at 17:46
  • Yes. I have type="text/twig" and I am getting a text icon. Although this is another question: can I have a unique (custom) icon for the twig types? – tyebillion Apr 24 '17 at 18:23
  • 1
    @tyebillion - yes, see link in my comment above (which sends you to another comment of mine on another question of yours...) – don_crissti Apr 24 '17 at 18:23
  • unix.stackexchange.com/questions/177760/… other than what you've already said this talks about changing the Nautilus source code which sounds a bit drastic. – tyebillion Apr 24 '17 at 19:51
  • There are 2 answers in the link I just referenced above not to mention other further links. – tyebillion Apr 24 '17 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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