From d62f0e24064dc931f1349dc77b961590d4336a1f Mon Sep 17 00:00:00 2001 From: tiyn Date: Mon, 5 Dec 2022 03:40:31 +0100 Subject: [PATCH] mime: added entry --- wiki/linux/mime.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 wiki/linux/mime.md diff --git a/wiki/linux/mime.md b/wiki/linux/mime.md new file mode 100644 index 0000000..71062b9 --- /dev/null +++ b/wiki/linux/mime.md @@ -0,0 +1,52 @@ +# MIME + +A MIME type (short for Multipurpose Internet Mail Extensions) is a identifier +for file formats and contents on the internet. + +## Setting applications for MIME types + +In `~/.config/mimeapps.list` a list of applications to run specific MIME +types can be found. +An example file looks like the following: + +```txt +[Default Applications] +text/x-shellscript=text.desktop; +x-scheme-handler/magnet=torrent.desktop; +application/x-bittorrent=torrent.desktop; +x-scheme-handler/mailto=mail.desktop; +text/plain=text.desktop; +application/postscript=pdf.desktop; +application/pdf=pdf.desktop; +image/png=img.desktop; +image/jpeg=img.desktop; +image/gif=img.desktop; +application/rss+xml=rss.desktop +video/x-matroska=video.desktop +inode/directory=file.desktop +``` + +A line consists of a MIME type left of the equals sign and an application on +the right of it. +The application can be found in `~/.local/share/applications/`. +In this directory a file for every application on the right side of the equals +sign with the same title can be found. + +A simple application file looks like the following example of `img.desktop`: + +```txt +[Desktop Entry] +Type=Application +Name=Image viewer +Exec=/usr/bin/sxiv -a %f +``` + +Atleast `Type`, `Name` and `Exec` have to be specified for a minimal +application file. + +## Getting MIME type of a file + +The MIME type of a file can be returned by running +`xdg-mime query filetype ` or `file -b --mime-type image.png`. +The MIME type can be then used to set default applications as explained in +[the section regarding setting applications for MIME types](#setting-applications-for-mime-types).