1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-17 14:51:04 +02:00

feat: add networkmanager module

This commit is contained in:
Reinout Meliesie 2024-02-10 17:12:07 +01:00 committed by Jake Stanger
parent fb6ae42f3b
commit 6d0fe4c8ac
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
10 changed files with 414 additions and 2 deletions

View file

@ -12,6 +12,8 @@ pub mod compositor;
pub mod lua;
#[cfg(feature = "music")]
pub mod music;
#[cfg(feature = "network_manager")]
pub mod networkmanager;
#[cfg(feature = "notifications")]
pub mod swaync;
#[cfg(feature = "tray")]
@ -35,6 +37,8 @@ pub struct Clients {
lua: Option<Rc<lua::LuaEngine>>,
#[cfg(feature = "music")]
music: std::collections::HashMap<music::ClientType, Arc<dyn music::MusicClient>>,
#[cfg(feature = "network_manager")]
network_manager: Option<Arc<networkmanager::Client>>,
#[cfg(feature = "notifications")]
notifications: Option<Arc<swaync::Client>>,
#[cfg(feature = "tray")]
@ -96,6 +100,18 @@ impl Clients {
.clone()
}
#[cfg(feature = "network_manager")]
pub fn network_manager(&mut self) -> ClientResult<networkmanager::Client> {
match &self.network_manager {
Some(client) => Ok(client.clone()),
None => {
let client = networkmanager::create_client()?;
self.network_manager = Some(client.clone());
Ok(client)
}
}
}
#[cfg(feature = "notifications")]
pub fn notifications(&mut self) -> ClientResult<swaync::Client> {
let client = match &self.notifications {