Desktop Items: Difference between revisions

Created an article about Desktop Items
 
m Rewrote a paragraph to be more comprehensible
 
Line 17: Line 17:
====Copying desktop items====
====Copying desktop items====


Desktop items are typically stored within <code>application</code> subdirectories of paths assigned to the <code>XDG_DATA_DIRS</code> environment variable. On NixOS, those files get included in that variable after being copied to an installed package's <code>$out/share/applications</code> directory. This can be achieved by either linking or copying the files in a phase manually, or by using the [https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/setup-hooks/copy-desktop-items.sh copyDesktopItems] hook:
The environment variable <code>XDG_DATA_DIRS</code> can be read by application launchers in search of desktop files. More specifically, it lists paths which may contain <code>applications</code> directories that store them. On NixOS, once a package is installed, its desktop items become discoverable by that variable so long as they are placed in the package output's <code>$out/share/applications</code> directory. This can be achieved by either linking or copying the files there, during an installation [[Derivations#Phases|phase]], or by using the [https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/setup-hooks/copy-desktop-items.sh copyDesktopItems] hook:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">