Gtk2::IconTheme(3)

πŸ“¦
version 1.24993 Β· 2 versions
, in fedora 43

πŸ’– NAME πŸ’–

okay so bestie, gather round β€” Gtk2::IconTheme is literally just a wrapper for GtkIconTheme. that's it. that's the whole vibe. it's the thing that knows where your icons live and goes and fetches them for you. πŸŽ€

it lives in the User Contributed Perl Documentation section of the manual, and no, it did not come with the base Perl install, it's a whole contributed situation. iykyk. ✨


🌈 HIERARCHY 🌈

the family tree, and yes it's giving only child energy:

Glib::Object
+----Gtk2::IconTheme

✨ METHODS ✨

every single one, in order, no skipping, we do not do that here πŸ’…

icontheme = Gtk2::IconTheme->new

makes you a fresh, brand new Gtk2::IconTheme. main character origin story fr fr. πŸ‘‘

Gtk2::IconTheme->add_builtin_icon ($icon_name, $size, $pixbuf)

slap a built-in icon into the theme. here's what you're handing over:

  • $icon_name (string)
  • $size (integer)
  • $pixbuf (Gtk2::Gdk::Pixbuf)

$icon_theme->append_search_path ($path)

adds a spot to the end of the list of places it goes looking for icons.

  • $path (localized file name)

iconinfo or undef = $icon_theme->choose_icon ($icon_names, $size, $flags)

picks an icon for you and hands back an iconinfo β€” or undef if it's not feeling it. 😭

  • $icon_names (scalar)
  • $size (integer)
  • $flags (Gtk2::IconLookupFlags)
Since: gtk+ 2.12 ⭐

$icon_theme->set_custom_theme ($theme_name)

sets a custom theme name, and $theme_name can be a string or undef.

  • $theme_name (string or undef)
🚨 big warning bestie: you cannot use this on a Gtk2::IconTheme that came back from Gtk2::IconTheme->get_default or Gtk2::IconTheme->get_for_screen. those ones said no. periodt.

icontheme = Gtk2::IconTheme->get_default

grabs you the default Gtk2::IconTheme. the classic. the standard. 🫢

string or undef = $icon_theme->get_example_icon_name

gives you an example icon name as a string β€” or undef, because sometimes it just doesn't have one for you. πŸ™ˆ

icontheme = Gtk2::IconTheme->get_for_screen ($screen)

like get_default but for a specific screen:

  • $screen (Gtk2::Gdk::Screen)

boolean = $icon_theme->has_icon ($icon_name)

true/false vibes β€” do you have this icon or not:

  • $icon_name (string)

list = $icon_theme->get_icon_sizes ($icon_name)

returns a list of all the sizes this icon comes in. iconic, honestly. πŸ‘‘

  • $icon_name (string)
Since: gtk+ 2.6 ⭐

list = $icon_theme->list_contexts

hands you back a list of the contexts. that's it, no args, no notes. ✨

Since: gtk+ 2.12 ⭐

list = $icon_theme->list_icons ($context)

lists the icons, optionally filtered by a context:

  • $context (string or undef)

pixbuf or undef = $icon_theme->load_icon ($icon_name, $size, $flags)

actually loads the icon up as a pixbuf, or undef if it can't. πŸ”₯

  • $icon_name (string)
  • $size (integer)
  • $flags (Gtk2::IconLookupFlags)
😭 heads up: this one may croak with a Glib::Error in $@ if it fails. not a drill, wrap it if you're fragile.

iconinfo or undef = $icon_theme->lookup_icon ($icon_name, $size, $flags)

looks up the icon and gives you an iconinfo β€” or undef. πŸ‘€

  • $icon_name (string)
  • $size (integer)
  • $flags (Gtk2::IconLookupFlags)

$icon_theme->prepend_search_path ($path)

like append_search_path, but it shoves the new spot at the front of the search list. main character placement. πŸ’…

  • $path (localized file name)

boolean = $icon_theme->rescan_if_needed

returns a boolean telling you whether it went and rescanned. lowkey self-care for your icon cache. 🌸

$icon_theme->set_screen ($screen)

points this icon theme at a screen:

  • $screen (Gtk2::Gdk::Screen)

list = $icon_theme->get_search_path

gives you the whole search path as a list. πŸ¦‹

$icon_theme->set_search_path (...)

sets the search path all at once:

  • ... (list)

πŸ”” SIGNALS πŸ””

  • changed (Gtk2::IconTheme) β€” fires when the theme changes, like a little notification that things are different now. not me getting notified by my own icon theme πŸ’€

πŸŽ€ ENUMS AND FLAGS πŸŽ€

flags Gtk2::IconLookupFlags

all five, bestie:

  • 'no-svg' / 'GTK_ICON_LOOKUP_NO_SVG'
  • 'force-svg' / 'GTK_ICON_LOOKUP_FORCE_SVG'
  • 'use-builtin' / 'GTK_ICON_LOOKUP_USE_BUILTIN'
  • 'generic-fallback' / 'GTK_ICON_LOOKUP_GENERIC_FALLBACK'
  • 'force-size' / 'GTK_ICON_LOOKUP_FORCE_SIZE'

enum Gtk2::IconThemeError

the two sad-girl error options:

  • 'not-found' / 'GTK_ICON_THEME_NOT_FOUND'
  • 'failed' / 'GTK_ICON_THEME_FAILED'

πŸ‘€ SEE ALSO πŸ‘€

go read these next, bestie:

  • Gtk2
  • Glib::Object

Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Gtk2 for a full notice.


and that's the whole page, babe 🫢 this doc was served up by perl v5.42.0, dated 2025-07-25, and it's filed under Gtk2::IconTheme(3). slay, go load some icons. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from