Default applications: Difference between revisions

From Alpine Linux
(Correct the mupdf path)
No edit summary
Line 4: Line 4:
In the following example we want to make mupdf the default command to open pdf files.
In the following example we want to make mupdf the default command to open pdf files.
First you need to create a desktop file, because mupdf doesn't provide one.
First you need to create a desktop file, because mupdf doesn't provide one.
{{Cmd|$ cat > ~/.local/share/applications/mupdf.desktop}}
{{cat|~/.local/share/applications/mupdf.desktop
<pre>
<nowiki>
 
[Desktop Entry]
[Desktop Entry]
Type=Application
Type=Application
Line 11: Line 12:
Exec=/usr/bin/mupdf-gl
Exec=/usr/bin/mupdf-gl
Name=mupdf
Name=mupdf
</pre>
</nowiki>
}}
 
Then you must use xdg to associate the desktop file with the pdf extension.
Then you must use xdg to associate the desktop file with the pdf extension.
{{Cmd|$ xdg-mime default mupdf.desktop application/pdf}}
{{Cmd|$ xdg-mime default mupdf.desktop application/pdf}}

Revision as of 21:54, 7 December 2018

To change the default application associated with a filetype you must use the xdg-mime command and point to the desired desktop file (if it doesn't exist, you must create one).

Example

In the following example we want to make mupdf the default command to open pdf files. First you need to create a desktop file, because mupdf doesn't provide one.

Contents of ~/.local/share/applications/mupdf.desktop

[Desktop Entry] Type=Application Terminal=false Exec=/usr/bin/mupdf-gl Name=mupdf

{{{2}}}

Then you must use xdg to associate the desktop file with the pdf extension.

$ xdg-mime default mupdf.desktop application/pdf

That's all.