From 0658011fdb08b363a18b3694aec927ced9c05523 Mon Sep 17 00:00:00 2001 From: Victor Fuentes Date: Mon, 7 Sep 2026 12:24:56 -0700 Subject: [PATCH] gnome-shell: refresh icons after profile switches GNOME checks for icon changes based on directory modification time. Since Nix hardcodes modification time to 1, GNOME never detects when icons are changed, leading to missing icons in the application menu on newly installed programs. To fix we now also invalidate icon cache on device and inode changes. --- .../icon-theme-directory-identity.patch | 44 +++++++++++++++++++ pkgs/by-name/gn/gnome-shell/package.nix | 3 ++ 2 files changed, 47 insertions(+) create mode 100644 pkgs/by-name/gn/gnome-shell/icon-theme-directory-identity.patch diff --git a/pkgs/by-name/gn/gnome-shell/icon-theme-directory-identity.patch b/pkgs/by-name/gn/gnome-shell/icon-theme-directory-identity.patch new file mode 100644 index 000000000000..dd45044af18c --- /dev/null +++ b/pkgs/by-name/gn/gnome-shell/icon-theme-directory-identity.patch @@ -0,0 +1,44 @@ +diff --git a/src/st/st-icon-theme.c b/src/st/st-icon-theme.c +--- a/src/st/st-icon-theme.c ++++ b/src/st/st-icon-theme.c +@@ -220,6 +220,8 @@ typedef struct + { + char *dir; + time_t mtime; ++ dev_t device; ++ ino_t inode; + StIconCache *cache; + gboolean exists; + } IconThemeDirMtime; +@@ -792,6 +794,8 @@ insert_theme (StIconTheme *icon_theme, + dir_mtime->dir = path; + if (g_stat (path, &stat_buf) == 0 && S_ISDIR (stat_buf.st_mode)) { + dir_mtime->mtime = stat_buf.st_mtime; ++ dir_mtime->device = stat_buf.st_dev; ++ dir_mtime->inode = stat_buf.st_ino; + dir_mtime->exists = TRUE; + } else { + dir_mtime->mtime = 0; +@@ -1029,6 +1033,8 @@ load_themes (StIconTheme *icon_theme) + if (g_stat (dir, &stat_buf) != 0 || !S_ISDIR (stat_buf.st_mode)) + continue; + dir_mtime->mtime = stat_buf.st_mtime; ++ dir_mtime->device = stat_buf.st_dev; ++ dir_mtime->inode = stat_buf.st_ino; + dir_mtime->exists = TRUE; + + dir_mtime->cache = st_icon_cache_new_for_path (dir); +@@ -2120,10 +2126,12 @@ rescan_themes (StIconTheme *icon_theme) +- /* dir mtime didn't change */ ++ /* dir identity and mtime didn't change. */ + if (stat_res == 0 && dir_mtime->exists && + S_ISDIR (stat_buf.st_mode) && ++ dir_mtime->device == stat_buf.st_dev && ++ dir_mtime->inode == stat_buf.st_ino && + dir_mtime->mtime == stat_buf.st_mtime) + continue; + /* didn't exist before, and still doesn't */ + if (!dir_mtime->exists && + (stat_res != 0 || !S_ISDIR (stat_buf.st_mode))) + continue; + diff --git a/pkgs/by-name/gn/gnome-shell/package.nix b/pkgs/by-name/gn/gnome-shell/package.nix index d0b8d6bd6b67..5e43836fbfa1 100644 --- a/pkgs/by-name/gn/gnome-shell/package.nix +++ b/pkgs/by-name/gn/gnome-shell/package.nix @@ -100,6 +100,9 @@ stdenv.mkDerivation (finalAttrs: { # Make D-Bus services wrappable. ./wrap-services.patch + # Detect profile switches even when icon directory mtimes are unchanged. + ./icon-theme-directory-identity.patch + # Fix greeter logo being too big. # https://gitlab.gnome.org/GNOME/gnome-shell/issues/2591 # Reverts https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1101