1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-09-16 11:46:58 +02:00

refactor: introduce networkmanager client

This commit is contained in:
Reinout Meliesie 2024-04-18 01:22:55 +02:00
commit 1044da251e
Signed by: zedfrigg
GPG key ID: 3AFCC06481308BC6
5 changed files with 269 additions and 103 deletions

View file

@ -7,6 +7,8 @@ pub mod clipboard;
pub mod compositor;
#[cfg(feature = "music")]
pub mod music;
#[cfg(feature = "networkmanager")]
pub mod networkmanager;
#[cfg(feature = "notifications")]
pub mod swaync;
#[cfg(feature = "tray")]
@ -28,6 +30,8 @@ pub struct Clients {
clipboard: Option<Arc<clipboard::Client>>,
#[cfg(feature = "music")]
music: std::collections::HashMap<music::ClientType, Arc<dyn music::MusicClient>>,
#[cfg(feature = "networkmanager")]
networkmanager: Option<Arc<networkmanager::Client>>,
#[cfg(feature = "notifications")]
notifications: Option<Arc<swaync::Client>>,
#[cfg(feature = "tray")]
@ -76,6 +80,13 @@ impl Clients {
.clone()
}
#[cfg(feature = "networkmanager")]
pub fn networkmanager(&mut self) -> Arc<networkmanager::Client> {
self.networkmanager
.get_or_insert_with(networkmanager::create_client)
.clone()
}
#[cfg(feature = "notifications")]
pub fn notifications(&mut self) -> Arc<swaync::Client> {
self.notifications