сряда, 15 декември 2010 г.

HOWTO change your File Associations

Ok, since I installed Calibre, I have serious problem with files I opened with kwrite, which now Calibre decides to be eBooks and tries to open them and add them to its database. That's obviously extremely annoying when all you want is to open your text file and edit it.
With simple associations like text files, I dealt easily clicking with the right button the txt files and telling KDE that I want kwrite to be my default application. Same happened also for .tex files. So these are fixed.
I have serious problem with .job files and .mw files which sometimes KDE remembers to open with kwrite, but sometimes doesn't. So I needed to find where KDE(and Linux as a whole) stores its file associations and to change them. Here's what I found.
1.) /usr/share/applications/defaults.list
-- I didn't have that file, but you can see all of your .desktop files in the directory.
2.) /usr/share/applications/mimeinfo.cache
-- Here you can find all the file associations and this is the file you must edit.
3.) ~/.local/share/applications/mimeapps.list
-- Not complete list of the associations, you might want to check/edit that file too, just to make sure everything is correct.


Edit the files:
$ sudo gedit /usr/share/applications/defaults.list
or if you like me don't have the above file:
$ sudo gedit /usr/share/applications/mimeinfo.cache
and also
$ gedit ~/.local/share/applications/mimeapps.list
Find the place that interests you, in my case any mentioning of Calibre. Find those lines (with ctrl+f) and then reorder the applications:
For example:
text/plain=calibre-ebook-viewer.desktop;calibre-gui.desktop;writer.desktop;kde4-kwrite.desktop;
should become:
text/plain=writer.desktop;kde4-kwrite.desktop;calibre-ebook-viewer.desktop;calibre-gui.desktop;
Just make sure, the application you want to open that file type is the first in the row. If you want to add application that you don't see in the row, look for its name in " /usr/share/applications/" (it will be something.desktop) and write that name.
Do that on all the places where your application occur in the file or to all file types you want to reorder.
Save and exit. Don't forget that after each application in the row, you need to put semi-colon! And also in the end of each line!
"Step 4:
Final step, and yes it's easy :-). All you have to do now is make your changes final. I have yet to find another...simply just logout then back in to see the fantastic changes." (source)


Enjoy!

Няма коментари:

Публикуване на коментар