fix(bar): fall back to older pid icon lookups

This commit imports an older revision of my fork of windows-icons to
call when attempting to look up the icon of an application by it's
process id. This needs to be cleaned up before the next release.
This commit is contained in:
LGUG2Z
2025-03-26 15:15:42 -07:00
parent e702d93a8a
commit d897890032
3 changed files with 26 additions and 3 deletions

14
Cargo.lock generated
View File

@@ -2745,7 +2745,8 @@ dependencies = [
"tracing-subscriber",
"windows 0.61.1",
"windows-core 0.61.0",
"windows-icons",
"windows-icons 0.1.0 (git+https://github.com/LGUG2Z/windows-icons?rev=0c9d7ee1b807347c507d3a9862dd007b4d3f4354)",
"windows-icons 0.1.0 (git+https://github.com/LGUG2Z/windows-icons?rev=d67cc9920aa9b4883393e411fb4fa2ddd4c498b5)",
]
[[package]]
@@ -6290,6 +6291,17 @@ dependencies = [
"windows 0.58.0",
]
[[package]]
name = "windows-icons"
version = "0.1.0"
source = "git+https://github.com/LGUG2Z/windows-icons?rev=d67cc9920aa9b4883393e411fb4fa2ddd4c498b5#d67cc9920aa9b4883393e411fb4fa2ddd4c498b5"
dependencies = [
"base64",
"image",
"winapi",
"windows 0.58.0",
]
[[package]]
name = "windows-implement"
version = "0.57.0"

View File

@@ -38,6 +38,7 @@ tracing-subscriber = { workspace = true }
windows = { workspace = true }
windows-core = { workspace = true }
windows-icons = { git = "https://github.com/LGUG2Z/windows-icons", rev = "0c9d7ee1b807347c507d3a9862dd007b4d3f4354" }
windows-icons-fallback = { package = "windows-icons", git = "https://github.com/LGUG2Z/windows-icons", rev = "d67cc9920aa9b4883393e411fb4fa2ddd4c498b5" }
[features]
default = ["schemars"]

View File

@@ -841,7 +841,12 @@ impl From<&Container> for KomorebiNotificationStateContainerInformation {
match icon_cache.get(&hwnd) {
None => {
icons.push(windows_icons::get_icon_by_hwnd(window.hwnd));
let icon = match windows_icons::get_icon_by_hwnd(window.hwnd) {
None => windows_icons_fallback::get_icon_by_process_id(window.process_id()),
Some(icon) => Some(icon),
};
icons.push(icon);
update_cache = true;
}
Some(icon) => {
@@ -877,7 +882,12 @@ impl From<&Window> for KomorebiNotificationStateContainerInformation {
match icon_cache.get(&hwnd) {
None => {
icons.push(windows_icons::get_icon_by_hwnd(value.hwnd));
let icon = match windows_icons::get_icon_by_hwnd(hwnd) {
None => windows_icons_fallback::get_icon_by_process_id(value.process_id()),
Some(icon) => Some(icon),
};
icons.push(icon);
update_cache = true;
}
Some(icon) => {