feature/prod-ready #1
@@ -16,4 +16,5 @@ tokio = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
linicon = "2.3.0"
|
||||
xdg = "3"
|
||||
|
||||
@@ -103,11 +103,21 @@ pub fn resolve_icon_path(name: &str) -> Option<String> {
|
||||
if name.starts_with('/') && Path::new(name).exists() {
|
||||
return Some(name.to_string());
|
||||
}
|
||||
// Try linicon freedesktop theme traversal
|
||||
let themes = ["hicolor", "Adwaita", "breeze", "Papirus"];
|
||||
for theme in &themes {
|
||||
if let Some(icon_path) = linicon::lookup_icon(name)
|
||||
.from_theme(theme)
|
||||
.with_size(48)
|
||||
.find_map(|r| r.ok())
|
||||
{
|
||||
return Some(icon_path.path.to_string_lossy().into_owned());
|
||||
}
|
||||
}
|
||||
// Fallback to pixmaps
|
||||
let candidates = [
|
||||
format!("/usr/share/pixmaps/{name}.png"),
|
||||
format!("/usr/share/pixmaps/{name}.svg"),
|
||||
format!("/usr/share/icons/hicolor/48x48/apps/{name}.png"),
|
||||
format!("/usr/share/icons/hicolor/scalable/apps/{name}.svg"),
|
||||
];
|
||||
candidates.into_iter().find(|p| Path::new(p).exists())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user