[PR #1439] [MERGED] Refactor: Applications Widget & Icon Caching #1401

Closed
opened 2026-01-05 14:55:09 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/LGUG2Z/komorebi/pull/1439
Author: @JustForFun88
Created: 5/12/2025
Status: Merged
Merged: 5/16/2025
Merged by: @LGUG2Z

Base: masterHead: applications_refactor


📝 Commits (2)

  • b0052cd Create global cache structure widgets::ICONS_CACHE
  • 258b51e Merge branch 'master' into applications_refactor

📊 Changes

4 files changed (+316 additions, -164 deletions)

View changed files

📝 komorebi-bar/src/main.rs (+0 -7)
📝 komorebi-bar/src/widgets/applications.rs (+138 -89)
📝 komorebi-bar/src/widgets/komorebi.rs (+19 -68)
📝 komorebi-bar/src/widgets/mod.rs (+159 -0)

📄 Description

I understand this PR combines two areas of work — refactoring the Applications widget and introducing a new icon caching system — which would ideally be submitted separately.

Originally, I only intended to reduce allocations and simplify icon loading in applications.rs, but as I worked through it, it became clear that a more general-purpose caching system was needed. One improvement led to another ... 😄

Apologies for bundling these changes together. If needed, I’m happy to split this PR into smaller, focused ones.

Key Changes

  • Introduced IconsCache with unified in-memory image & texture management.
  • Added ImageIcon and ImageIconId (based on path or HWND) for caching and reuse.
  • Icon::Image now wraps ImageIcon, decoupled from direct RgbaImage usage.
  • Extracted app launch logic into UserCommand with built-in cooldown.
  • Simplified config parsing and UI hover rendering in App.
  • Replaced legacy ICON_CACHE in KomorebiNotificationStateContainerInformation
    → Now uses the shared ImageIcon::try_load(hwnd, ..) with caching and fallback.

Motivation

  • Reduce redundant image copies and avoid repeated pixel-to-texture conversions.
  • Cleanly separate concerns for launching and icon handling.
  • Reuse icons across Applications, Komorebi windows, and potentially more in the future.

Tested

  • Works on Windows 11.
  • Verified path/exe/HWND icon loading and fallback.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/LGUG2Z/komorebi/pull/1439 **Author:** [@JustForFun88](https://github.com/JustForFun88) **Created:** 5/12/2025 **Status:** ✅ Merged **Merged:** 5/16/2025 **Merged by:** [@LGUG2Z](https://github.com/LGUG2Z) **Base:** `master` ← **Head:** `applications_refactor` --- ### 📝 Commits (2) - [`b0052cd`](https://github.com/LGUG2Z/komorebi/commit/b0052cdcd09d41f7a596a91a28efa74cbaf39504) Create global cache structure widgets::ICONS_CACHE - [`258b51e`](https://github.com/LGUG2Z/komorebi/commit/258b51e4ce7f15bb32ef26f289bab7e42465f7f6) Merge branch 'master' into applications_refactor ### 📊 Changes **4 files changed** (+316 additions, -164 deletions) <details> <summary>View changed files</summary> 📝 `komorebi-bar/src/main.rs` (+0 -7) 📝 `komorebi-bar/src/widgets/applications.rs` (+138 -89) 📝 `komorebi-bar/src/widgets/komorebi.rs` (+19 -68) 📝 `komorebi-bar/src/widgets/mod.rs` (+159 -0) </details> ### 📄 Description I understand this PR combines two areas of work — **refactoring the Applications widget** and **introducing a new icon caching system** — which would ideally be submitted separately. Originally, I only intended to reduce allocations and simplify icon loading in `applications.rs`, but as I worked through it, it became clear that a more general-purpose caching system was needed. One improvement led to another ... 😄 Apologies for bundling these changes together. If needed, I’m happy to split this PR into smaller, focused ones. ### Key Changes - Introduced `IconsCache` with unified in-memory image & texture management. - Added `ImageIcon` and `ImageIconId` (based on path or HWND) for caching and reuse. - `Icon::Image` now wraps `ImageIcon`, decoupled from direct `RgbaImage` usage. - Extracted app launch logic into `UserCommand` with built-in cooldown. - Simplified config parsing and UI hover rendering in `App`. - **Replaced legacy `ICON_CACHE` in `KomorebiNotificationStateContainerInformation`** → Now uses the shared `ImageIcon::try_load(hwnd, ..)` with caching and fallback. ### Motivation - Reduce redundant image copies and avoid repeated pixel-to-texture conversions. - Cleanly separate concerns for launching and icon handling. - Reuse icons across `Applications`, Komorebi windows, and potentially more in the future. ### Tested - Works on Windows 11. - Verified path/exe/HWND icon loading and fallback. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-01-05 14:55:09 +01:00
adam closed this issue 2026-01-05 14:55:09 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/komorebi#1401