Default applications: Difference between revisions

34j (talk | contribs)
Note the way to list all .desktop-files
Wjtje (talk | contribs)
Added information about how a user can find out what mime type a file is, and changed the other shell code to a syntaxhighlight block
 
(One intermediate revision by the same user not shown)
Line 19: Line 19:
To list all .desktop-files, run
To list all .desktop-files, run


<pre>
<syntaxhighlight lang="nix">
ls /run/current-system/sw/share/applications # for global packages
ls /run/current-system/sw/share/applications # for global packages
ls /etc/profiles/per-user/$(id -n -u)/share/applications # for user packages
ls ~/.nix-profile/share/applications # for home-manager packages
ls ~/.nix-profile/share/applications # for home-manager packages
</pre>
</syntaxhighlight>


In case a program is missing a .desktop-file, the following example adds a <code>librewolf.desktop</code> file to the MIME database with the specific binary path.<syntaxhighlight lang="nix">
In case a program is missing a .desktop-file, the following example adds a <code>librewolf.desktop</code> file to the MIME database with the specific binary path.<syntaxhighlight lang="nix">
Line 31: Line 32:
   };
   };
};
};
</syntaxhighlight>
If you don't know the exact mime type of a file, you can use the <code>file</code> command.
<syntaxhighlight lang="shell">
file --mime-type -b $file_name
</syntaxhighlight>
</syntaxhighlight>