LinuxCommandLibrary

gtk-update-icon-cache

Updates GTK+ icon theme caches

SYNOPSIS

gtk-update-icon-cache [OPTION...] ICON-DIR

PARAMETERS

-f, --force
    Overwrite existing cache even if unchanged

-i, --ignore-theme-index
    Recurse without using index.theme

-q, --quiet
    Suppress non-error output

-t, --index-only
    Update only index.theme, skip cache generation

-h, --help
    Display help and exit

-v, --version
    Output version information and exit

DESCRIPTION

The gtk-update-icon-cache command is a utility from the GTK+ toolkit used to generate or update binary cache files for icon directories. These caches, typically named icon-theme.cache, store indexed icon information to accelerate icon loading in GTK applications, avoiding the need to scan directories repeatedly at runtime.

It processes icon themes defined by an index.theme file in the directory, supporting scalable (SVG) and fixed-size PNG icons across various contexts like 'actions', 'apps', or 'devices'. Package managers invoke it automatically after installing or updating icon themes to ensure immediate usability.

Without a cache, GTK falls back to slower directory traversal, impacting performance in environments like GNOME. The tool supports recursion into subdirectories and handles theme inheritance. It's essential for developers packaging custom icons or system administrators maintaining desktop environments.

CAVEATS

Requires write permissions to ICON-DIR; cache invalidation may need manual trigger if icons change outside package updates. Not for Freedesktop.org themes (use xdg tools).

TYPICAL USAGE

After installing icons:
gtk-update-icon-cache /usr/share/icons/hicolor
Forces rebuild: gtk-update-icon-cache -f /path/to/theme

CACHE LOCATION

Generates icon-theme.cache in ICON-DIR; delete to force regeneration.

HISTORY

Introduced in GTK+ 2.4 (2005) to optimize icon loading amid growing theme complexity; evolved for GTK 3/4 with pixbuf format changes; widely used in Debian/Ubuntu postinst scripts since 2006.

SEE ALSO

Copied to clipboard