mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-01-11 14:40:25 +01:00
[PR #1491] refactor(ring): stop exposing Ring internals
#1428
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/1491
Author: @JustForFun88
Created: 6/21/2025
Status: 🔄 Open
Base:
master← Head:refactor_ring📝 Commits (1)
f9ea220Stop exposing Ring internals📊 Changes
20 files changed (+683 additions, -611 deletions)
View changed files
📝
komorebi-bar/src/bar.rs(+3 -3)📝
komorebi-bar/src/main.rs(+9 -18)📝
komorebi-bar/src/widgets/komorebi.rs(+5 -6)📝
komorebi-gui/src/main.rs(+1 -1)📝
komorebi/src/border_manager/mod.rs(+8 -11)📝
komorebi/src/container.rs(+8 -7)📝
komorebi/src/lib.rs(+0 -1)➖
komorebi/src/lockable_sequence.rs(+0 -357)📝
komorebi/src/monitor.rs(+2 -3)📝
komorebi/src/monitor_reconciliator/mod.rs(+7 -9)📝
komorebi/src/process_command.rs(+23 -24)📝
komorebi/src/process_event.rs(+1 -6)📝
komorebi/src/ring.rs(+502 -20)📝
komorebi/src/stackbar_manager/mod.rs(+1 -1)📝
komorebi/src/stackbar_manager/stackbar.rs(+2 -2)📝
komorebi/src/static_config.rs(+6 -6)📝
komorebi/src/transparency_manager.rs(+5 -5)📝
komorebi/src/window_manager.rs(+77 -94)📝
komorebi/src/windows_api.rs(+13 -20)📝
komorebi/src/workspace.rs(+10 -17)📄 Description
Summary
This PR hides the internals of the
Ring<T>type and reworks its API. Direct access to the internalVecDeque<T>is removed, so interaction withRingnow happens only through its methods, making it easier and safer to use.All lock-respecting insert/remove/swap logic is implemented directly on
Ringand the separateLockableSequencetrait removed.The new API is more ergonomic and expressive for common patterns. As a result, although many new methods were added to
Ringinkomorebi/src/ring.rs, the total code size increased only slightly, since many typical iterator chains are now replaced by single method calls.Motivation
Usability Improvements
Consistent Access: Field and accessor now always return
Ring, eliminating confusion between types (e.g.,&monitor.workspacesvsmonitor.workspaces()).Ergonomic usage: The new API is more ergonomic and expressive for common patterns
Tests
Tested on Windows 11.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.