Reload icons when apps change

GTK caches the icon theme and never rescans its directories, so newly
installed apps showed up without their icons.
This commit is contained in:
Henry Hiles 2026-11-17 00:12:08 -05:00
commit 42d273798b
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -253,7 +253,13 @@ app.connect("activate", () => {
fillPages() fillPages()
appInfoMonitor = Gio.AppInfoMonitor.get() appInfoMonitor = Gio.AppInfoMonitor.get()
appInfoMonitor.connect("changed", fillPages) appInfoMonitor.connect("changed", () => {
// GTK never rescans icon directories by itself, so new apps' icons wouldn't be found.
// Setting the search path, even to the same one, makes it reload.
const iconTheme = Gtk.IconTheme.get_for_display(win.get_display())
iconTheme.set_search_path(iconTheme.get_search_path())
fillPages()
})
const box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL }) const box = new Gtk.Box({ orientation: Gtk.Orientation.VERTICAL })
box.append(carousel) box.append(carousel)