diff options
| author | MaxVerevkin <maxxverrr@gmail.com> | 2023-08-26 16:56:58 +0300 |
|---|---|---|
| committer | MaxVerevkin <maxxverrr@gmail.com> | 2023-08-26 16:56:58 +0300 |
| commit | 6aeb76407a30309326a04b29d19e5390a4b96248 (patch) | |
| tree | a89a94b0e8a0a457bb6774a87cdc6be7b5e7bba3 /src/shared_state.rs | |
| parent | e07d9872f072ab63cf2d74950b989571b84b9826 (diff) | |
| download | i3bar-mango-6aeb76407a30309326a04b29d19e5390a4b96248.tar.gz | |
rework wm_info_provider stuff
Diffstat (limited to 'src/shared_state.rs')
| -rw-r--r-- | src/shared_state.rs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/shared_state.rs b/src/shared_state.rs index 2e87749..936b29a 100644 --- a/src/shared_state.rs +++ b/src/shared_state.rs @@ -1,6 +1,8 @@ use crate::{ - blocks_cache::BlocksCache, config::Config, status_cmd::StatusCmd, - wm_info_provider::WmInfoProvider, + blocks_cache::BlocksCache, + config::Config, + status_cmd::StatusCmd, + wm_info_provider::{self, WmInfoProvider}, }; use wayrs_utils::shm_alloc::ShmAlloc; @@ -10,5 +12,16 @@ pub struct SharedState { pub config: Config, pub status_cmd: Option<StatusCmd>, pub blocks_cache: BlocksCache, - pub wm_info_provider: WmInfoProvider, + pub wm_info_provider: Option<Box<dyn WmInfoProvider>>, +} + +impl SharedState { + pub fn get_river(&mut self) -> Option<&mut wm_info_provider::RiverInfoProvider> { + self.wm_info_provider.as_mut()?.as_any().downcast_mut() + } + + #[cfg(feature = "hyprland")] + pub fn get_ewu(&mut self) -> Option<&mut wm_info_provider::ExtWorkspaceUnstable> { + self.wm_info_provider.as_mut()?.as_any().downcast_mut() + } } |
