[PR #396] [MERGED] Massive Client Refactor #688

Closed
opened 2026-05-22 21:54:18 +01:00 by JakeStanger · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/JakeStanger/ironbar/pull/396
Author: @JakeStanger
Created: 1/8/2024
Status: Merged
Merged: 1/9/2024
Merged by: @JakeStanger

Base: masterHead: refactor/clients


📝 Commits (3)

  • 57b57ed refactor: pass context into modules controllers
  • c702f6f refactor: major client code changes
  • 6f531a5 refactor: remove lazy_static and async_once

📊 Changes

39 files changed (+1114 additions, -1101 deletions)

View changed files

📝 Cargo.lock (+85 -80)
📝 Cargo.toml (+3 -6)
📝 src/bar.rs (+16 -5)
📝 src/clients/clipboard.rs (+23 -27)
📝 src/clients/compositor/hyprland.rs (+10 -19)
📝 src/clients/compositor/mod.rs (+13 -7)
📝 src/clients/compositor/sway.rs (+22 -42)
📝 src/clients/mod.rs (+108 -0)
📝 src/clients/music/mod.rs (+8 -12)
📝 src/clients/music/mpd.rs (+64 -196)
📝 src/clients/music/mpris.rs (+7 -15)
📝 src/clients/system_tray.rs (+27 -25)
📝 src/clients/upower.rs (+24 -29)
src/clients/wayland/client.rs (+0 -269)
📝 src/clients/wayland/mod.rs (+284 -46)
📝 src/clients/wayland/wl_output.rs (+71 -22)
📝 src/clients/wayland/wl_seat.rs (+15 -12)
📝 src/clients/wayland/wlr_data_control/device.rs (+1 -0)
📝 src/clients/wayland/wlr_data_control/manager.rs (+1 -0)
📝 src/clients/wayland/wlr_data_control/mod.rs (+73 -27)

...and 19 more files

📄 Description

It's a big one!

This does away with lazy_static singletons for all the clients, instead putting them all inside a Clients struct on the Ironbar struct.

Client code has been refactored in places to accommodate this, and module code has been updated to get the clients the new way.

The Wayland client has been re-written from the ground up to remove a lot of the needless complications, provide a nicer interface and reduce some duplicate data.

The MPD music client has been overhauled to use the mpd_utils crate, which simplifies the code within Ironbar and should offer more robustness and better recovery when connection is lost to the server.

The launcher module in particular has been affected by the refactor.

Also included are some other factors that were necessary along the way, and the complete removal of lazy_static and async_once from the application.


This PR knowingly adds a few build warnings in, as some client code has been added for further upcoming changes. This is hopefully the last stepping stone to get #291 fixed.


🔄 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/JakeStanger/ironbar/pull/396 **Author:** [@JakeStanger](https://github.com/JakeStanger) **Created:** 1/8/2024 **Status:** ✅ Merged **Merged:** 1/9/2024 **Merged by:** [@JakeStanger](https://github.com/JakeStanger) **Base:** `master` ← **Head:** `refactor/clients` --- ### 📝 Commits (3) - [`57b57ed`](https://github.com/JakeStanger/ironbar/commit/57b57ed002c394eae6caa87836aa8769345781bc) refactor: pass context into modules controllers - [`c702f6f`](https://github.com/JakeStanger/ironbar/commit/c702f6fffa538037c47399dc2b5f7377252fff1b) refactor: major client code changes - [`6f531a5`](https://github.com/JakeStanger/ironbar/commit/6f531a5654b1554d1bbba5b56ce623d2bb4f4d83) refactor: remove `lazy_static` and `async_once` ### 📊 Changes **39 files changed** (+1114 additions, -1101 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+85 -80) 📝 `Cargo.toml` (+3 -6) 📝 `src/bar.rs` (+16 -5) 📝 `src/clients/clipboard.rs` (+23 -27) 📝 `src/clients/compositor/hyprland.rs` (+10 -19) 📝 `src/clients/compositor/mod.rs` (+13 -7) 📝 `src/clients/compositor/sway.rs` (+22 -42) 📝 `src/clients/mod.rs` (+108 -0) 📝 `src/clients/music/mod.rs` (+8 -12) 📝 `src/clients/music/mpd.rs` (+64 -196) 📝 `src/clients/music/mpris.rs` (+7 -15) 📝 `src/clients/system_tray.rs` (+27 -25) 📝 `src/clients/upower.rs` (+24 -29) ➖ `src/clients/wayland/client.rs` (+0 -269) 📝 `src/clients/wayland/mod.rs` (+284 -46) 📝 `src/clients/wayland/wl_output.rs` (+71 -22) 📝 `src/clients/wayland/wl_seat.rs` (+15 -12) 📝 `src/clients/wayland/wlr_data_control/device.rs` (+1 -0) 📝 `src/clients/wayland/wlr_data_control/manager.rs` (+1 -0) 📝 `src/clients/wayland/wlr_data_control/mod.rs` (+73 -27) _...and 19 more files_ </details> ### 📄 Description It's a big one! This does away with `lazy_static` singletons for all the clients, instead putting them all inside a `Clients` struct on the `Ironbar` struct. Client code has been refactored in places to accommodate this, and module code has been updated to get the clients the new way. The Wayland client has been re-written from the ground up to remove a lot of the needless complications, provide a nicer interface and reduce some duplicate data. The MPD music client has been overhauled to use the `mpd_utils` crate, which simplifies the code within Ironbar and should offer more robustness and better recovery when connection is lost to the server. The launcher module in particular has been affected by the refactor. Also included are some other factors that were necessary along the way, and the complete removal of `lazy_static` and `async_once` from the application. --- This PR knowingly adds a few build warnings in, as some client code has been added for further upcoming changes. This is hopefully the last stepping stone to get #291 fixed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
JakeStanger 2026-05-22 21:54:18 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/ironbar#688
No description provided.