mirror of
https://github.com/JakeStanger/ironbar.git
synced 2026-07-11 07:15:19 +01:00
[GH-ISSUE #1488] 🍝 Cleaning up ironbar's structure #6070
Labels
No labels
A:Build
A:CI
A:Client
A:Config
A:Core
A:Documentation
A:Documentation
A:IPC
A:Testing
A:UX/UI
blocked
BREAKING CHANGE
duplicate
good first issue
GTK4
help wanted
invalid
M:Battery
M:Battery
M:Bindmode
M:Bluetooth
M:Brightness
M:Cairo
M:Clipboard
M:Clock
M:Clock
M:Custom
M:Focused
M:Keyboard
M:Launcher
M:Menu
M:Music
M:Music
M:Music
M:Network Manager
M:Notifications
M:SysInfo
M:Tray
M:Volume
M:Workspaces
partially resolved
P:Critical
P:High
P:Low
P:Medium
pull-request
T:Bug
T:Bug
T:Core Enhancement
T:Module Enhancement
T:New Module
T:Question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
JakeStanger/ironbar#6070
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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?
Originally created by @esther-ff on GitHub (May 11, 2026).
Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/1488
Originally assigned to: @esther-ff on GitHub.
Basically, the idea is to decouple ironbar's very tangled code and split it into several crates to improve compile times and clarity because it is currently somewhat of a mess.
Me and @JakeStanger have talked a bit about it.
Currently we're at separating the client traits (and a client manager trait) into an
ironbar_traitscrate, that would allow us to put the implementations of modules intoironbar_modules.This allows for splitting the "core" code into
ironbar_coreand the implementation of a registry in the singletonIronbarstruct to avoid any circular dependencies. (the registry will rely onArc'ing the individual client implementations and downcasting of the references by the module which requires them).The base client trait would roughly look like this:
The use of
Anyallows each module to acquire adyn Clientand downcast it once to hold a concreteArcpointer to it's desired client while also allowing us to store it in a simple map as described below.The registry itself would be a
HashMap<ClientKind, Arc<dyn Client>or something similar.Here
ClientKindwould represent many types of clients used throughout modules.Example to better show off the idea: https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=f9ef1a66e92a66bf7b3048cb5dc4f65b
There is a possibility to also use a concurrent lock-free map like this one to allow converting the
Rc'dIronbarsingleton into a (lazy)staticwith a fewMutexes where they would be needed.I think also the separation of client code if successful would be a great model to handle modules similarly as a similar issue arises with them.
Input on this would be great as this would be somewhat a big overhaul, though it'd be best if the structure of module/client code itself wouldn't be affected much as it could break many PRs.
@JakeStanger commented on GitHub (May 12, 2026):
The current thinking is to split this into lots of small chunks to keep things easy to review and minimise the impact on outstanding PRs. This would roughly be:
Clienttrait and implement for all existing clients. This can be done bit by bit as the trait won't be used by anything at this stage. A suppression can be put on the unused warning if necessary.Clientsstruct with the new design, based on the playground link above. The expectation is this should not have much of a wider impact, and should play nicely with the existing module-facing API.ironbar_traitscrate, which the main crate depends on.ironbar_corecrate, which the main crate depends on. This will depend on the traits crate.ironbar_clientscrate, which the main crate depends on. This will depend on the traits crate, and probably the core crate.These steps will probably take a long time to be fully implemented and may stretch over several releases to soften the blow.
The eventual goal would be a structure that looks like this:
This should have quite a few benefits as mentioned above:
Rc<RefCell<T>>andArc<Mutex<T>>spam everywhere (maybe, hopefully)