gtk-update-icon-cache
Updates GTK+ icon theme caches
SYNOPSIS
gtk-update-icon-cache [OPTION...] ICON_THEME_DIR
PARAMETERS
-f, --force
Force recreation of the cache file, even if it appears up-to-date.
-q, --quiet
Run silently, suppressing all warnings and non-error output.
-v, --verbose
Enable verbose output, showing detailed information about the caching process.
--ignore-theme-dir
Do not include the theme directory name in the cached paths. Useful for shared icon directories.
--index-theme
Include information from the theme's 'index.theme' file in the cache. This is important for theme inheritance.
--include-image-data
Embed small icon image data directly into the cache file, potentially improving lookup speed for frequently used small icons.
ICON_THEME_DIR
The mandatory path to the GTK+ icon theme directory for which the cache should be updated.
DESCRIPTION
gtk-update-icon-cache is a utility program provided by the GTK+ toolkit. Its primary function is to create and update a cache file named icon-theme.cache within a specified GTK+ icon theme directory. This cache file acts as an index of all icons available within that theme, significantly speeding up the lookup process for GTK+ applications. Without this cache, applications would have to scan numerous directories and subdirectories every time they need to display an icon, leading to performance overhead. By pre-indexing the icons, gtk-update-icon-cache ensures that applications can quickly locate and load the necessary graphical assets, providing a smoother and more responsive user experience. It is typically run automatically by package managers when installing or updating icon themes, or it can be invoked manually by users or theme developers after making changes to an icon theme's contents.
CAVEATS
Running this command requires write permissions to the specified ICON_THEME_DIR. If permissions are insufficient, the cache file cannot be created or updated. While beneficial for performance, this command does not automatically detect changes; it must be run explicitly after icon theme modifications.
USAGE CONTEXT
This utility is most commonly invoked by package managers during the installation or upgrade of icon themes (e.g., through post-installation scripts). Users who manually install or modify icon themes located in their ~/.icons directory or system-wide /usr/share/icons directories may also need to run this command manually to ensure their changes are recognized by GTK+ applications.
CACHE FILE
The command generates an icon-theme.cache file inside the root of the specified icon theme directory. This binary file contains an optimized index of icon names, their paths, and metadata, allowing GTK+ applications to quickly locate the correct icon without extensively traversing the filesystem.
HISTORY
The need for gtk-update-icon-cache arose with the increasing complexity and size of icon themes in the GTK+ environment. As icon themes grew to include hundreds or thousands of icons across various sizes and categories, scanning directories on every icon request became a significant performance bottleneck. Introduced in GTK+ 2.x, this utility provides a mechanism to pre-index icon locations, greatly improving the responsiveness of GTK+ applications that utilize icon themes. It has remained a fundamental part of the GTK+ ecosystem through GTK+ 3.x and continues to be essential for efficient icon rendering.
SEE ALSO
gsettings(1), gdk-pixbuf-query-loaders(1), update-alternatives(8)