dh_icons - Linux
Overview
dh_icons is a utility for creating .desktop files and .svg icons for Debian packages. It is commonly used within the Debian packaging process to generate visual representations of installed applications for use in desktop environments.
Syntax
dh_icons [options] [package-name]
Options/Flags
- –classname=[class]: Sets the Class field in the .desktop file.
- –comment=[comment]: Sets the Comment field in the .desktop file.
- –desktop-file=[file-name]: Specifies the name of the generated .desktop file (default:
package-name.desktop
). - –displayname=[name]: Sets the Name field in the .desktop file.
- –group=[group]: Sets the Group field in the .desktop file.
- –iconic=[file-name]: Specifies the source icon to be converted to .svg format.
- –icon=[file-name]: Specifies the Icon field in the .desktop file.
- –keep=[version]: Specifies the version of the generated .desktop file to keep.
- –no-gtk=[theme-name]: Prevents generation of .svg icons for the specified GTK theme (e.g.,
Adwaita
). - –no-kde=[theme-name]: Prevents generation of .svg icons for the specified KDE theme (e.g.,
Breeze
). - –old-gtk=[version]: Generates .svg icons compatible with older versions of GTK (e.g.,
2.10
or3.0
). - –size=[size]: Specifies the output size of the generated .svg icons in pixels (default:
64
). - –subdir=[dir-name]: Specifies the subdirectory where the generated .desktop file and .svg icons will be placed (default:
usr/share/applications
).
Examples
Generating Basic Icons
To create icons for a package named my-package
, run:
dh_icons my-package
Customizing the .desktop File
To set a specific Name field in the .desktop file:
dh_icons --displayname="My Package" my-package
Selecting a Specific Icon
To specify a custom source icon for conversion:
dh_icons --iconic=my-icon.png my-package
Using Integration Options
To prevent icon generation for the GTK Adwaita
theme:
dh_icons --no-gtk=Adwaita my-package
Common Issues
Missing Icon Dependencies
If dh_icons fails due to missing dependencies, install the appropriate packages:
sudo apt install inkscape librsvg2-bin
Integration
dh_icons can be incorporated into Debian package build scripts using the dh package:
dh_make --buildsystem=debian
Related Commands
- dh – Debian helper utilities for package building
- desktop-file-validate – Validates .desktop files
- inkscape – Vector graphics editor used for icon conversion