AppImage managers write icons as extensionless files, so those apps got the generic icon. Any absolute path is now tried, and the loaders tell PNG and SVG apart from the contents. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
27252a97ab
commit
44688453d7
5 files changed
+18
-15
No files matched your search
@@ -21,10 +21,10 @@ fn frame_rgb(f : @renderer.Pixmap, x : Int, y : Int) -> (Int, Int, Int) {
|
||||
}
|
||||
|
||||
///| A compositor with the six fake apps of `desk_comp`, where app0's .desktop file says
|
||||
/// Icon=<an absolute path to a red PNG>.
|
||||
/// Icon=<an absolute path to a red PNG without an extension, as AppImage managers write it>.
|
||||
fn icon_comp(tag : String) -> @host.ChandraCompositor {
|
||||
let comp = desk_comp(tag)
|
||||
let png = "/tmp/chandra-icon-" + tag + "-" + @sys.getpid().to_string() + ".png"
|
||||
let png = "/tmp/chandra-icon-" + tag + "-" + @sys.getpid().to_string()
|
||||
write_icon_png(png, 230, 20, 20)
|
||||
comp.shell.exec.set("app0", "app0")
|
||||
comp.shell.icon_names.set("app0", png)
|
||||
|
||||
@@ -63,13 +63,9 @@ pub fn load_image(path : String) -> UInt {
|
||||
match loaded_images.get(path) {
|
||||
Some(h) => h
|
||||
None => {
|
||||
let h = if path.has_suffix(".png") {
|
||||
match @renderer.decode_png(@sys.read_file_bytes(path)) {
|
||||
Some(p) => @renderer.add_image(p)
|
||||
None => 0U
|
||||
}
|
||||
} else {
|
||||
0U
|
||||
let h = match @renderer.decode_png(@sys.read_file_bytes(path)) {
|
||||
Some(p) => @renderer.add_image(p)
|
||||
None => 0U
|
||||
}
|
||||
loaded_images.set(path, h)
|
||||
h
|
||||
|
||||
@@ -268,11 +268,9 @@ fn icon_candidates(
|
||||
return []
|
||||
}
|
||||
if name.has_prefix("/") {
|
||||
return if name.has_suffix(".png") || (svg_ok && name.has_suffix(".svg")) {
|
||||
[name]
|
||||
} else {
|
||||
[]
|
||||
}
|
||||
// Any file name: AppImage managers write icons without an extension, and the loader tells
|
||||
// the type from the contents.
|
||||
return if !svg_ok && name.has_suffix(".svg") { [] } else { [name] }
|
||||
}
|
||||
// Icon=foo.png is not allowed by the spec but common: look it up as "foo".
|
||||
let stem = if name.has_suffix(".png") || name.has_suffix(".svg") || name.has_suffix(".xpm") {
|
||||
|
||||
@@ -62,6 +62,7 @@ test "themes without an index.theme use the hicolor layout, then pixmaps" {
|
||||
assert_eq(icon_candidates("foo.png", false, [("hicolor", None)], ["/b"], [])[0], "/b/hicolor/48x48/apps/foo.png")
|
||||
assert_eq(icon_candidates("/opt/app/icon.png", false, [], ["/b"], []), ["/opt/app/icon.png"])
|
||||
assert_eq(icon_candidates("/opt/app/icon.svg", false, [], ["/b"], []), [])
|
||||
assert_eq(icon_candidates("/opt/app/.icons/app", false, [], ["/b"], []), ["/opt/app/.icons/app"])
|
||||
assert_eq(icon_candidates("", true, [], ["/b"], []), [])
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user