You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
App icons off macOS: freedesktop icon-theme lookup and SVG rasterising #21
Apps that show other apps' icons (launchers, switchers, permission panels) need them off macOS too. On macOS, ImageCache already decodes ICNS.
Needed (Linux): a lookup from a desktop-file ID or icon name to an image through the freedesktop icon theme spec (the current theme, hicolor fallback, size and scale selection), plus SVG rasterising (e.g. resvg) at the requested size and scale, off the UI thread, through ImageCache. Windows: icons from an executable or AppUserModelID. Open question: does this belong in rune core (an image source) or in a small companion crate? Leaning core, as an image source behind a feature flag.
Double-checked on a stock Ubuntu 24.04 box (no Noto Symbols): the hicolor + SVG + pixmaps path from 6c9d971 is live and covered — ImageCache::app_icon → linux_icon → freedesktop::icon_file + resvg svg_rgba.
What the issue text still asks for beyond that, and what I found probing the real theme dirs here:
Current-theme lookup (missing): icon_file scans only icons/hicolor. The session theme here is Humanity/Adwaita territory; accessories-dictionary.svg ships only in Humanity/apps/48 (no hicolor copy), so it resolves to nothing today. Same for any theme-installed icon reachable only through Inherits (Humanity → Adwaita → hicolor). PR Linux: FreeSerif symbol fallback, session-theme icons, single-instance, GNOME toplevel fallback (fixes #2, #20, #21, #22) #29 (commit 35329d7) implements the theme-chain lookup in crates/rune/src/image.rs: read the XDG_CURRENT_DESKTOP theme, fall back Adwaita → Humanity → hicolor, follow Inherits breadth-first, match directories verbatim from each index.theme (Humanity's apps/48, @2 scaled sets), smallest covering bitmap → scalable SVG (resvg) → largest → pixmaps.
Verification: temp-theme unit test (hicolor ladder incl. 48x48@2 = 96px), an Inherits-chain test, and a real-system probe — accessories-dictionary.svg resolves inside Humanity and rasterizes 96×96 with visible pixels through app_icon_rgba. cargo test -p rune --lib image:: green.
Open question in the issue (core vs companion crate): the implementation lives in core behind no new flag (resvg + zbus already core deps). Say the word if it should sit behind a feature flag instead.
Strata (lgse/strata), a file manager on Rune, shows other apps' icons (Open With) and MIME-type icons, and hits these limits of ImageCache::app_icon on Linux at 67d73a5f:
The user's theme. As the 2026-10-26 comment found, freedesktop::icon_file (crates/rune-image/src/app_icon.rs:151-180) still scans icons/hicolor only (:159).
index.theme sizes. It reads a size from the directory name (48x48, @2), not the theme's Size, Type, Threshold, MinSize, MaxSize and Scale.
Lookup by name. It takes a .desktop path only, and looks in apps/ only, so a MIME icon name (text-x-python, in mimetypes/) or a list of fallback names (as GThemedIcon gives) can't be looked up.
Not found. A missing icon and a broken file both resolve to Image::error.
ImageCache::new(waker).app_icon_scaled("$T/share/applications/fixture.desktop", 48.0, 1.0) fails with no icon for $T/share/applications/fixture.desktop, while the same PNG under icons/hicolor/48x48/apps is found. Nothing names a theme to look in.
What would cover it: an image source taking the theme by name, ImageCache::themed_icon(names, theme, size_pt, scale), following the Icon Theme Specification, with "not found" apart from a decode error. Or, smaller: a way to run a path lookup on the cache's worker (cache.file_with(|| -> Option<PathBuf>, size_pt, scale)), so a crate doing the lookup needs no thread of its own.
Full Linux freedesktop icon-theme lookup, ImageCache::themed_icon, rune::image::themed_icon_rgba, and Image::is_not_found() are now on dev in #1979 (766e35f50).
What was built
Freedesktop Icon Theme Specification lookup (crates/rune-image/src/freedesktop.rs): parses index.theme ([Icon Theme]Inherits, Directories, ScaledDirectories and per-directory Size, Scale, Type = Fixed | Scalable | Threshold, MinSize, MaxSize, Threshold, Context), selects icons with DirectoryMatchesSize and DirectorySizeDistance, walks Inherits breadth-first ending at hicolor then pixmaps, detects the current Linux desktop theme from GTK settings.ini / KDE kdeglobals (falling back to Adwaita → hicolor), and caches parsed theme indices in a bounded 64-theme / 4 MiB LRU cache.
Upgraded ImageCache::app_icon / app_icon_scaled on Linux: .desktop entries now resolve through the full active theme chain instead of scanning icons/hicolor only.
New API (additive, keeping ImageError(pub String) unchanged):
Image::is_not_found(&self) -> bool (separates missing icons/files from corrupt-file decode errors)
let icon = cache.themed_icon(&["text-x-python","text-plain"],None,24.0, env.scale);if icon.size().is_some(){el().size(24.0,24.0).pixels_fit(icon.pixels(),SurfaceFit::Fit)}elseif icon.is_not_found(){fallback_badge()}
Outside answer & design notes
Follows the Freedesktop Icon Theme Specification and GTK 4 gtk_icon_theme_lookup_icon / GThemedIcon fallback order (trying each name in names in order across the full theme chain so a specific icon in hicolor is not shadowed by a generic fallback in the active theme).
Instead of adding a generic worker closure (file_with), this implements the full spec directly on the existing ImageCache decoder worker. Windows executable/icon extraction is already supported in app_icon; if Windows AppUserModelID lookup or anything else in this API doesn't fit your use case, please comment or open a follow-up issue.
Verification
Verified with fixture tests across Windows (cargo test -p rune-image 74 unit + 8 doc, --no-default-features 67 unit + 8 doc, rune image/pills/pixels_streaming tests, launcher test, check-wasm / check-webgl), headless Linux aarch64 (cargo test -p rune-image 73 unit + 8 doc), and macOS arm64 (cargo test -p rune-image 75 unit + 8 doc).
Not verified: a live Linux desktop session reading real host GTK/KDE themes in a rendered window, or workspace-wide check -p rune -p rune-kit -p launcher on Linux/macOS.
Activity
ImBIOS commentedon Oct 26, 2026
Double-checked on a stock Ubuntu 24.04 box (no Noto Symbols): the hicolor + SVG + pixmaps path from 6c9d971 is live and covered —
ImageCache::app_icon→linux_icon→freedesktop::icon_file+ resvgsvg_rgba.What the issue text still asks for beyond that, and what I found probing the real theme dirs here:
icon_filescans onlyicons/hicolor. The session theme here is Humanity/Adwaita territory;accessories-dictionary.svgships only inHumanity/apps/48(no hicolor copy), so it resolves to nothing today. Same for any theme-installed icon reachable only throughInherits(Humanity → Adwaita → hicolor). PR Linux: FreeSerif symbol fallback, session-theme icons, single-instance, GNOME toplevel fallback (fixes #2, #20, #21, #22) #29 (commit35329d7) implements the theme-chain lookup incrates/rune/src/image.rs: read theXDG_CURRENT_DESKTOPtheme, fall back Adwaita → Humanity → hicolor, followInheritsbreadth-first, match directories verbatim from eachindex.theme(Humanity'sapps/48,@2scaled sets), smallest covering bitmap → scalable SVG (resvg) → largest → pixmaps.48x48@2= 96px), an Inherits-chain test, and a real-system probe —accessories-dictionary.svgresolves inside Humanity and rasterizes 96×96 with visible pixels throughapp_icon_rgba.cargo test -p rune --lib image::green.resvg+zbusalready core deps). Say the word if it should sit behind a feature flag instead.Linux icons: session-theme + Inherits lookup; single instance via org…
Linux icons: session-theme + Inherits lookup; single instance via org…
Linux icons: session-theme + Inherits lookup; single instance via org…
Linux icons: session-theme + Inherits lookup; single instance via org…
Linux icons: session-theme + Inherits lookup; single instance via org…
Linux icons: session-theme + Inherits lookup; single instance via org…
Linux icons: session-theme + Inherits lookup; single instance via org…
Linux icons: session-theme + Inherits lookup; single instance via org…
Linux icons: session-theme + Inherits lookup; single instance via org…
wmfeht commentedon Nov 22, 2026
Strata (lgse/strata), a file manager on Rune, shows other apps' icons (Open With) and MIME-type icons, and hits these limits of
ImageCache::app_iconon Linux at67d73a5f:freedesktop::icon_file(crates/rune-image/src/app_icon.rs:151-180) still scansicons/hicoloronly (:159).index.themesizes. It reads a size from the directory name (48x48,@2), not the theme'sSize,Type,Threshold,MinSize,MaxSizeandScale..desktoppath only, and looks inapps/only, so a MIME icon name (text-x-python, inmimetypes/) or a list of fallback names (asGThemedIcongives) can't be looked up.Image::error.Headless, with
XDG_DATA_HOME=$T/share:ImageCache::new(waker).app_icon_scaled("$T/share/applications/fixture.desktop", 48.0, 1.0)fails withno icon for $T/share/applications/fixture.desktop, while the same PNG undericons/hicolor/48x48/appsis found. Nothing names a theme to look in.What would cover it: an image source taking the theme by name,
ImageCache::themed_icon(names, theme, size_pt, scale), following the Icon Theme Specification, with "not found" apart from a decode error. Or, smaller: a way to run a path lookup on the cache's worker (cache.file_with(|| -> Option<PathBuf>, size_pt, scale)), so a crate doing the lookup needs no thread of its own.Hona commentedon Nov 24, 2026
Full Linux freedesktop icon-theme lookup,
ImageCache::themed_icon,rune::image::themed_icon_rgba, andImage::is_not_found()are now ondevin #1979 (766e35f50).What was built
crates/rune-image/src/freedesktop.rs): parsesindex.theme([Icon Theme]Inherits,Directories,ScaledDirectoriesand per-directorySize,Scale,Type=Fixed | Scalable | Threshold,MinSize,MaxSize,Threshold,Context), selects icons withDirectoryMatchesSizeandDirectorySizeDistance, walksInheritsbreadth-first ending athicolorthenpixmaps, detects the current Linux desktop theme from GTKsettings.ini/ KDEkdeglobals(falling back toAdwaita→hicolor), and caches parsed theme indices in a bounded 64-theme / 4 MiB LRU cache.ImageCache::app_icon/app_icon_scaledon Linux:.desktopentries now resolve through the full active theme chain instead of scanningicons/hicoloronly.ImageError(pub String)unchanged):ImageCache::themed_icon(&self, names: &[&str], theme: Option<&str>, size_pt: f32, scale: f32) -> Imagerune::image::themed_icon_rgba(names: &[&str], theme: Option<&str>, px: u32, scale: u32) -> Result<Option<(u32, u32, Vec<u8>)>, ImageError>Image::is_not_found(&self) -> bool(separates missing icons/files from corrupt-file decode errors)Outside answer & design notes
gtk_icon_theme_lookup_icon/GThemedIconfallback order (trying each name innamesin order across the full theme chain so a specific icon inhicoloris not shadowed by a generic fallback in the active theme).file_with), this implements the full spec directly on the existingImageCachedecoder worker. Windows executable/icon extraction is already supported inapp_icon; if Windows AppUserModelID lookup or anything else in this API doesn't fit your use case, please comment or open a follow-up issue.Verification
cargo test -p rune-image74 unit + 8 doc,--no-default-features67 unit + 8 doc,runeimage/pills/pixels_streaming tests,launchertest,check-wasm/check-webgl), headless Linux aarch64 (cargo test -p rune-image73 unit + 8 doc), and macOS arm64 (cargo test -p rune-image75 unit + 8 doc).check -p rune -p rune-kit -p launcheron Linux/macOS.