This PR significantly refactors the Komorebi bar rendering logic, simplifying state management, and addressing some found bugs. The primary motivation was to make the codebase more readable and maintainable.
Key Changes
Allocation Reduction: Removed most per-frame structure allocations.
Runtime Matching Elimination: Replaced runtime pattern matching with pre-selected function pointers determined at initialization. Widget validations and configurations are now performed during widget creation rather than per-frame checks. For example, widget enablement is now handled by an Option that wraps each ..Bar structure. If a widget is enabled, its structure is present; otherwise, it is None. This eliminates the need for runtime enabled checks.
Widget Modularity: Code is split into smaller parts, reducing complexity.
Found bug fixes:
Corrected icon sizing for floating windows following regular containers, ensuring icons revert correctly from icon_size to text_size.
There was also another bug with a floating window positioned above a monocle container, but I forgot the details 😅 (will update after additional testing).
Testing
Each commit is self-contained, independently compilable, and testable.
Legacy rendering logic was preserved until final commits to facilitate parallel testing.
Some parts of the new code have already been tested for 2-3 weeks, but not all changes are fully covered yet, so additional testing is needed.
🔄 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/1465
**Author:** [@JustForFun88](https://github.com/JustForFun88)
**Created:** 5/27/2025
**Status:** ✅ Merged
**Merged:** 8/1/2025
**Merged by:** [@LGUG2Z](https://github.com/LGUG2Z)
**Base:** `master` ← **Head:** `ContainerInformation`
---
### 📝 Commits (9)
- [`2283d14`](https://github.com/LGUG2Z/komorebi/commit/2283d14ae8f16066b052cf60dc0ffe40b628f77f) Creatre and use MonitorInfo instead of KomorebiNotificationState
- [`7d5e7ab`](https://github.com/LGUG2Z/komorebi/commit/7d5e7ab64319e796d4df46c5f039a72a60c0c134) Remove unused `stack_accent`
- [`2ce6c1e`](https://github.com/LGUG2Z/komorebi/commit/2ce6c1e4c66480c5cca60e389fe63717981d578b) Extract WorkspacesBar
- [`c8e7b81`](https://github.com/LGUG2Z/komorebi/commit/c8e7b81ef9f0efecfcc453128752ca43698aa456) Extract `render_layout`
- [`694df48`](https://github.com/LGUG2Z/komorebi/commit/694df48f8cdf3e6e6f08e8a41b70711f36cea53b) Extract `FocusedContainerBar`
- [`95d88c6`](https://github.com/LGUG2Z/komorebi/commit/95d88c6ad38d6f0fde42e8f8b756f824ce85f85b) Extract `WorkspaceLayerBar`
- [`5a986e4`](https://github.com/LGUG2Z/komorebi/commit/5a986e476a2334fa56e5075302f54484e41f7a8f) Extract `LockedContainerBar`
- [`68e7f79`](https://github.com/LGUG2Z/komorebi/commit/68e7f79198aec568be2c9435ee74fa9e27269670) Extract `render_config_switcher`
- [`275cea8`](https://github.com/LGUG2Z/komorebi/commit/275cea8ad6ac3525e0ff203312e8c1ae1e8174cc) Remove old code
### 📊 Changes
**3 files changed** (+898 additions, -775 deletions)
<details>
<summary>View changed files</summary>
📝 `komorebi-bar/src/bar.rs` (+101 -66)
📝 `komorebi-bar/src/widgets/komorebi.rs` (+791 -707)
📝 `komorebi-client/src/lib.rs` (+6 -2)
</details>
### 📄 Description
This PR significantly refactors the `Komorebi` bar rendering logic, simplifying state management, and addressing some found bugs. The primary motivation was to make the codebase more readable and maintainable.
## Key Changes
- Allocation Reduction: Removed most per-frame structure allocations.
- Runtime Matching Elimination: Replaced runtime pattern matching with pre-selected function pointers determined at initialization. Widget validations and configurations are now performed during widget creation rather than per-frame checks. For example, widget enablement is now handled by an Option that wraps each `..Bar` structure. If a widget is enabled, its structure is present; otherwise, it is None. This eliminates the need for runtime enabled checks.
- Widget Modularity: Code is split into smaller parts, reducing complexity.
## Found bug fixes:
- Corrected icon sizing for floating windows following regular containers, ensuring icons revert correctly from `icon_size` to `text_size`.
- There was also another bug with a floating window positioned above a monocle container, but I forgot the details 😅 (will update after additional testing).
## Testing
- Each commit is self-contained, independently compilable, and testable.
- Legacy rendering logic was preserved until final commits to facilitate parallel testing.
Some parts of the new code have already been tested for 2-3 weeks, but not all changes are fully covered yet, so additional testing is needed.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/LGUG2Z/komorebi/pull/1465
Author: @JustForFun88
Created: 5/27/2025
Status: ✅ Merged
Merged: 8/1/2025
Merged by: @LGUG2Z
Base:
master← Head:ContainerInformation📝 Commits (9)
2283d14Creatre and use MonitorInfo instead of KomorebiNotificationState7d5e7abRemove unusedstack_accent2ce6c1eExtract WorkspacesBarc8e7b81Extractrender_layout694df48ExtractFocusedContainerBar95d88c6ExtractWorkspaceLayerBar5a986e4ExtractLockedContainerBar68e7f79Extractrender_config_switcher275cea8Remove old code📊 Changes
3 files changed (+898 additions, -775 deletions)
View changed files
📝
komorebi-bar/src/bar.rs(+101 -66)📝
komorebi-bar/src/widgets/komorebi.rs(+791 -707)📝
komorebi-client/src/lib.rs(+6 -2)📄 Description
This PR significantly refactors the
Komorebibar rendering logic, simplifying state management, and addressing some found bugs. The primary motivation was to make the codebase more readable and maintainable.Key Changes
..Barstructure. If a widget is enabled, its structure is present; otherwise, it is None. This eliminates the need for runtime enabled checks.Found bug fixes:
icon_sizetotext_size.Testing
Some parts of the new code have already been tested for 2-3 weeks, but not all changes are fully covered yet, so additional testing is needed.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.