Packaging/Icons: Difference between revisions

imported>Milahu
init
 
Ardenet (talk | contribs)
mNo edit summary
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Application icons ==
<languages />
<translate>
== Application icons == <!--T:1-->


<!--T:2-->
Application icons should be installed to <code>$out/share/icons/hicolor</code>.
Application icons should be installed to <code>$out/share/icons/hicolor</code>.


Example code for the [https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/office/scribus/1_4.nix scribus] app:
<!--T:3-->
Example code for the now outdated [https://github.com/nixos/nixpkgs/blob/c8e5c5c2228ddd58f01b7229e0bb4a92a9585990/pkgs/applications/office/scribus/1_4.nix scribus v1.4] app:
</translate>


<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
Line 9: Line 14:
, stdenv
, stdenv
, fetchurl
, fetchurl
, imagemagick
}:
}:


Line 20: Line 26:
stdenv.mkDerivation rec {
stdenv.mkDerivation rec {
   pname = "scribus";
   pname = "scribus";
  nativeBuildInputs = [
    imagemagick # convert
  ];


   # ...
   # ...
Line 26: Line 36:
     for i in 16 24 48 64 96 128 256 512; do
     for i in 16 24 48 64 96 128 256 512; do
       mkdir -p $out/share/icons/hicolor/''${i}x''${i}/apps
       mkdir -p $out/share/icons/hicolor/''${i}x''${i}/apps
       convert -background none -resize ''${i}x''${i} ${icon} $out/share/icons/hicolor/''${i}x''${i}/apps/scribus.png
       convert -background none -resize ''${i}x''${i} ${icon} $out/share/icons/hicolor/''${i}x''${i}/apps/${pname}.png
     done
     done
   '';
   '';
Line 33: Line 43:
</syntaxHighlight>
</syntaxHighlight>


Note: The icon filename contains the app name, here: <code>scribus.png</code>.
<translate>
 
<!--T:4-->
<code>-background none</code> will create transparent icons.
<code>-background none</code> will create transparent icons.
Alternative: <code>-background white</code>.
Alternative: <code>-background white</code>.
=== See also === <!--T:5-->
<!--T:6-->
Another example handling icons [https://github.com/NixOS/nixpkgs/blob/6d8e9b4f6197f7ce5106069f13debfc8e9b1fa8b/pkgs/applications/misc/obsidian/default.nix#L62 obsidian].
</translate>