diff --git a/Cargo.lock b/Cargo.lock index 989cbf01..217f7bd7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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" diff --git a/komorebi-bar/Cargo.toml b/komorebi-bar/Cargo.toml index cd3461e9..145180eb 100644 --- a/komorebi-bar/Cargo.toml +++ b/komorebi-bar/Cargo.toml @@ -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"] diff --git a/komorebi-bar/src/widgets/komorebi.rs b/komorebi-bar/src/widgets/komorebi.rs index a19cab52..34805051 100644 --- a/komorebi-bar/src/widgets/komorebi.rs +++ b/komorebi-bar/src/widgets/komorebi.rs @@ -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) => {