📜 ⬆️ ⬇️

Set up associations for files in Firefox under Gentoo

Gentoo users probably noticed that Firefox refuses to offer options for “open with” when downloading a file. Against this behavior, Firefox has a fairly simple recipe. I will consider it on the example of pdf.

So, when downloading a file, Firefox gets the mime-type from the server, and it looks for the presence of this mime-type in two files - / etc / mailcap and $ HOME / .mailcap. The first will be valid for all users, the second - respectively, for the user in whose home directory is created. This file describes how certain mime-types recorded in it are processed. It came from the time of utilities such as mailx, which in the standard delivery did not know how to open mime attachments, and required external utilities such as metamail for this.

The format of the mailcap file in the simplest case is as follows:
')
mime-family/mime-type; command-to-run %s

Already for recording in this format, everything will work correctly. You can also add the test directive, which will check the necessary condition. To find out the mime-type of the file, use the command file -bi filename.

So, for example, create an entry for pdf. I want to view it using okular from kde-4. And I consider it mandatory for all users of my workstation. We define the mime-type of the file.

$ file myfile.pdf
application/pdf

Accordingly, in / etc / mailcap we add the line:

application/pdf; okular '%s'

That's enough. We are checking.

Source: https://habr.com/ru/post/49784/


All Articles