You are not logged in.
This may be more of a general Linux question, but because I'm using XFCE I'm asking here first. Apologies in advance for the length of this question.
How can I edit the file type that Thunar, (or Dolphin, Nautilus, etc) reports in the Detailed List view? I'm not talking about associating a file extension with an application, (that's my next question), I'm referring to the file type that is reported based on the file's extension.
For example, as a user of an EDA suite called Kicad, I have files on my system with an extension of '.mod'. These are module files used in creating printed circuit board layouts. File managers report these as 'Amiga SoundTracker audio' files, and assign a music note as the icon. I'm pretty much certain that I'll never have a SoundTracker file on my system, so I'd like to assign my own file type information for files with a '.mod' extension, and have Thunar report that information instead. At the very least, I'd like to remove any reference to 'Amiga SoundTracker file' from my system.
On a related note, is there any way to force Thunar to look at the extension only and ignore whatever other method is used to determine file types? Again using to Kicad as an example, the schematic and PCB files are in plain text format. Thunar, (or the underlying Linux stuff it uses), recognizes these as text files and offers to open them in my text editor. I can also associate these files with Kicad - the problem is that Thunar then offers to open ANY text file with Kicad, as well as with a text editor or whatever. Of course, Kicad does not recognize any text files that aren't in its own specific format, so there's no reason to associate a text file with Kicad unless it has a .sch, .brd, or .pro extension.
I'd even be happy with associating files by extension only, and totally disabling any other method of recognition - in fact, that might be the best solution for me.
Any insights or suggestions here are much appreciated.
Thanks
Offline
You can look at http://www.freedesktop.org/wiki/Specifi … -info-spec and http://www.freedesktop.org/wiki/Specifi … tions-spec
I suppose you could use 'xdg-mime install ...': http://portland.freedesktop.org/wiki/XdgUtils
If the MIME types for the app you use aren't defined properly yet, you could contribute through the mailing list (see http://www.freedesktop.org/wiki/ ).
These are to get deep into the subject, as you asked.
Offline
I'm not sure, but perhaps is it possible to change the mimetypes in /usr/share/mime.
Don't forget an backup before.
Offline
Secipolla has provided the essential links to the right info above. But beyond that, we can proceed to create the new mimetype. So firstly, open up a terminal as root, and create a new file, kicad.xml, in the /usr/share/mime/packages folder. The filename doesn't have to be kicad.xml, it can be anything unique like blah.xml too. And again, I'm using geany, but you can use your own favourite text editor...
cd /usr/share/mime/packages
geany kicad.xml
And into that new file, plz cut and paste the following basic mimetype definition...
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-kicad-module">
<comment>Kicad Module File</comment>
<glob weight="60" pattern="*.mod"/>
<icon name="application-x-kicad-module"/>
</mime-type>
</mime-info>
Basically, the xml files in /usr/share/mime/packages contain the mimetype definitions for your system. And here we have added a new mimetype "application/x-kicad-module". And those files will use the generic icon "application-x-kicad-module" (if it exists). But the mimetype and icon names I've used here are pure guesswork for this example, so plz substitute and replace with more appropriate choices.
But there is already a standard mimetype for *.mod files - an audio filetype as you described above. So I've added a " weight=60 " term into our xml, to give our new mimetype a priority of 60, which is higher than the default of 50. Thus ensuring that our new mimetype takes precedence over the existing one.
Okay. Save your file, and exit your text editor. Now we need to rebuild the mimetype database.
cd /usr/share/mime
update-mime-database $PWD
And that should do it. Please reboot your system, and then see if Thunar detects the new mimetype.
Offline
Thanks to everyone who replied. Special thanks to daggoth - you rock! Now I'm off to fix up all the file associations I want to change.
I'm also going to study the links provided by secipolla, with a view to a) registering some MIME types with freedesktop.org, and b) writing a tutorial that expands on the procedure provided by daggoth.
Cheers!
Offline
[ Generated in 0.016 seconds, 7 queries executed - Memory usage: 535.78 KiB (Peak: 536.63 KiB) ]