General TC > Programming & Scripting - Unofficial

minimalistic approach to MIME types / filetype associations

(1/5) > >>

GNUser:
I wanted my GUI applications to open files using my preferred applications, but I didn't want to install the (overly complex)  xdg-utils  extension.

So I forked the  linopen  shell script (see https://wiki.archlinux.org/index.php/Default_applications), took out all the bashisms and GNUisms, and rebaptized it as tinyopen. (Rich helped with the most difficult step which was to find a workaround for BusyBox ps's missing "+" mark for foreground processes). All you need to use  tinyopen  instead of  xdg-open  is to put the script somewhere in your PATH and make  xdg-open  be a symlink to the script. Filetype associations are managed in ~/.config/tinyopenrc
https://github.com/bdantas/tinyopen

Some applications ignore  xdg-open  completely and, instead, they parse ~/.config/mimeapps.list (some older applications still look for this file in its old, deprecated location: ~/.local/share/applications/mimeapps.list). To satisfy these applications, manually create ~/.config/mimepps.list and make ~/.local/share/applications/mimeapps.list a symlink to it.

That's all there's to it :) Now you can manage all your filetype associations right in ~/.config by touching only two files:
1. ~/.config/tinyopenrc for applications that use xdg-open
2. ~/.config/mimeapps.list for applications that directly parse this file or its symlink at ~/.local/share/applications/mimeapps.list

jazzbiker:
Well, just like the deep breath of clear air, thanks a lot!

GNUser:
You're welcome, jazzbiker. I hope you find it useful.

Because TCL is so uncluttered, it has helped me understand many things that seemed hopelessly complicated before (such as filetype associations). TCL rocks.

GNUser:
I realized that I don't like having to manage two separate config files (~/.config/tinyopenrc for the set of applications that use xdg-open, ~/.config/mimeapps.list for the separate set of applications that use the XDG standard). I want to manage only ~/.config/tinyopenrc! ;D

So I created /usr/local/share/applications/xdg-open.desktop, which is trivial and looks like this:

--- Code: ---[Desktop Entry]
Name=xdg-open
Exec=xdg-open
Icon=xdg-open
Type=Application
Categories=Utility;
--- End code ---

Then I went here to get a list of all existing MIME types: https://www.iana.org/assignments/media-types/media-types.xhtml
With the complete list, I created a ~/.config/mimeapps.list that associates every existing MIME type with xdg-open.desktop.
My ~/.config/mimeapps.list is here: http://files.dantas.airpost.net/public/mimeapps.list

So there you go. Now I manage all my filetype associations in one place: ~/.config/tinyopenrc 8)

aus9:
HI @GNUser

can you re-check link for http://files.dantas.airpost.net/public/mimeapps.list
going up one level I am none the wiser
http://files.dantas.airpost.net/public/

Navigation

[0] Message Index

[#] Next page

Go to full version