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:
parent
e1094ca586
commit
1044da251e
5 changed files with 269 additions and 103 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue