mirror of
https://github.com/Zedfrigg/ironbar.git
synced 2025-07-16 00:51:02 +02:00
refactor: major client code changes
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.
This commit is contained in:
parent
57b57ed002
commit
c702f6fffa
33 changed files with 1081 additions and 1063 deletions
|
@ -1,7 +1,7 @@
|
|||
use crate::clients::system_tray::get_tray_event_client;
|
||||
use crate::clients::system_tray::TrayEventReceiver;
|
||||
use crate::config::CommonConfig;
|
||||
use crate::modules::{Module, ModuleInfo, ModuleParts, ModuleUpdateEvent, WidgetContext};
|
||||
use crate::{await_sync, glib_recv, spawn, try_send};
|
||||
use crate::{glib_recv, spawn, try_send};
|
||||
use color_eyre::Result;
|
||||
use glib::ffi::g_strfreev;
|
||||
use glib::translate::ToGlibPtr;
|
||||
|
@ -171,8 +171,10 @@ impl Module<MenuBar> for TrayModule {
|
|||
context: &WidgetContext<Self::SendMessage, Self::ReceiveMessage>,
|
||||
mut rx: Receiver<Self::ReceiveMessage>,
|
||||
) -> Result<()> {
|
||||
let client = await_sync(async { get_tray_event_client().await });
|
||||
let tx = context.tx.clone();
|
||||
|
||||
let client = context.client::<TrayEventReceiver>();
|
||||
|
||||
let (tray_tx, mut tray_rx) = client.subscribe();
|
||||
|
||||
// listen to tray updates
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue