mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-01-11 14:40:25 +01:00
[PR #1439] [MERGED] Refactor: Applications Widget & Icon Caching #1401
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 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:
master← Head:applications_refactor📝 Commits (2)
b0052cdCreate global cache structure widgets::ICONS_CACHE258b51eMerge 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
IconsCachewith unified in-memory image & texture management.ImageIconandImageIconId(based on path or HWND) for caching and reuse.Icon::Imagenow wrapsImageIcon, decoupled from directRgbaImageusage.UserCommandwith built-in cooldown.App.ICON_CACHEinKomorebiNotificationStateContainerInformation→ Now uses the shared
ImageIcon::try_load(hwnd, ..)with caching and fallback.Motivation
Applications, Komorebi windows, and potentially more in the future.Tested
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.