fix(desktop): Install Linux theme icons named after the app id #14471
Mergedmwolson(GitHub profile, opens in a new tab)merged 1 commit into
main fromrefs/pull/14471/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- apps/desktop/src/app/DesktopLinuxUrlHandler.ts lines 218 to 220Resolvedby mwolson(GitHub profile, opens in a new tab)@@ -188,0 +206,21 @@206+ const command = ChildProcess.make("gtk-update-icon-cache", ["-f", "-t", hicolorDir], {207+ stdin: "ignore",208+ stdout: "ignore",209+ stderr: "ignore",210+ // Releasing a timed-out helper otherwise waits on SIGTERM indefinitely.211+ forceKillAfter: "1 second",212+ });213+ const handle = yield* spawner.spawn(command);214+ return yield* handle.exitCode.pipe(Effect.timeout("5 seconds"));215+ }),216+ );217+218+ const modifiedAt = (filePath: string) =>219+ fileSystem220+ .stat(filePath)221+ .pipe(Effect.map((info) => Option.getOrUndefined(info.mtime)?.getTime() ?? 0));222+223+ const installThemeIcons = Effect.gen(function* () {224+ const source = yield* assets.resolveResourcePath(`icons/${LINUX_THEME_ICON_SIZE}.png`);225+ if (Option.isNone(source)) return;226+ const icon = yield* fileSystem.readFile(source.value);
- apps/desktop/src/app/DesktopLinuxUrlHandler.ts line 257OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -188,0 +237,21 @@237+ }238+ // Only keep an existing cache current. Creating one would leave GTK reading239+ // a cache that other tools installing user icons do not update. An icon240+ // newer than the cache also retries a refresh that failed on an earlier241+ // launch.242+ const cachePath = environment.path.join(hicolorDir, "icon-theme.cache");243+ const cachedAt = yield* modifiedAt(cachePath).pipe(Effect.option);244+ if (Option.isNone(cachedAt)) return;245+ let stale = changed;246+ for (const target of targets) {247+ if (stale) break;248+ if ((yield* modifiedAt(target)) > cachedAt.value) stale = true;249+ }250+ if (!stale) return;251+ const exitCode = yield* refreshIconThemeCache;252+ if (exitCode !== 0) {253+ yield* logWarning("icon theme cache refresh failed", { hicolorDir, exitCode });254+ }255+ }).pipe(256+ Effect.catch((error) =>257+ logWarning("app id theme icon install failed", { themeIconDir, message: error.message }),
juliusmarminge added labelsmacroscope-review
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge merged thisf98118d
juliusmarminge closed this
Sign in to join this conversation.




macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed