mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-01-11 14:40:25 +01:00
[PR #1495] refactor (window): Lazy, Single-pass Evaluation of Window Properties and Efficient Rule Matching #1431
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/1495
Author: @JustForFun88
Created: 6/29/2025
Status: 🔄 Open
Base:
master← Head:simple_should_act📝 Commits (6)
f9ea220Stop exposing Ring internals862a55fUseArc<str>andWsElementIdinstead ofString3020684make serialize and deserialize compact8cbf024MakeWindowinternals private.86b297fMake clippy happy796e928Removeshould_act, useWindow::matches_rule📊 Changes
41 files changed (+1818 additions, -2177 deletions)
View changed files
📝
komorebi-bar/src/bar.rs(+18 -22)📝
komorebi-bar/src/main.rs(+13 -23)📝
komorebi-bar/src/widgets/battery.rs(+1 -1)📝
komorebi-bar/src/widgets/cpu.rs(+3 -3)📝
komorebi-bar/src/widgets/date.rs(+1 -1)📝
komorebi-bar/src/widgets/komorebi.rs(+10 -11)📝
komorebi-bar/src/widgets/komorebi_layout.rs(+2 -3)📝
komorebi-bar/src/widgets/memory.rs(+3 -3)📝
komorebi-bar/src/widgets/mod.rs(+5 -4)📝
komorebi-bar/src/widgets/network.rs(+2 -2)📝
komorebi-bar/src/widgets/storage.rs(+2 -2)📝
komorebi-bar/src/widgets/time.rs(+1 -1)📝
komorebi-bar/src/widgets/update.rs(+1 -1)📝
komorebi-gui/src/main.rs(+8 -8)📝
komorebi/src/animation/prefix.rs(+1 -1)📝
komorebi/src/border_manager/border.rs(+54 -37)📝
komorebi/src/border_manager/mod.rs(+152 -129)📝
komorebi/src/container.rs(+49 -67)📝
komorebi/src/core/mod.rs(+16 -1)📝
komorebi/src/focus_manager.rs(+5 -5)...and 21 more files
📄 Description
The PR is based on #1494.
This PR brings a major internal cleanup to window matching and rule evaluation. It not only minimizes code, but also removes wasteful allocations and short-circuits at the first failure during composite rule checks.
Main improvements
Lazy evaluation of window properties:
Previously, all
Windowproperties (title,exe,class,path) were computed up front even if only one was actually needed by the rules. Now, each property is computed on demand—when the rule requires it—and never more than once per matching operation.For example, code like:
is now:
Elimination of unnecessary allocations for composite rules:
Previously, evaluating
MatchingRule::Compositecollected all results in aVecbefore checking if they were all true. Now, evaluation is fully short-circuiting and allocation-free:Smaller codebase. All boilerplate removed.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.