diff options
| author | MaxVerevkin <maxxverrr@gmail.com> | 2023-09-07 17:42:38 +0300 |
|---|---|---|
| committer | MaxVerevkin <maxxverrr@gmail.com> | 2023-09-07 17:42:38 +0300 |
| commit | f6e91b9622db2a5772a0bf6bc6006c6f5a3eff4a (patch) | |
| tree | 4dcaea3214d7e99c205007be4a31a0bb25366678 /src/wm_info_provider | |
| parent | 87673d7ecce661f3b8c5db949e70640934a55de9 (diff) | |
| download | i3bar-mango-f6e91b9622db2a5772a0bf6bc6006c6f5a3eff4a.tar.gz | |
more refactoring
Diffstat (limited to 'src/wm_info_provider')
| -rw-r--r-- | src/wm_info_provider/dummy.rs | 9 | ||||
| -rw-r--r-- | src/wm_info_provider/hyprland.rs | 6 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/wm_info_provider/dummy.rs b/src/wm_info_provider/dummy.rs new file mode 100644 index 0000000..72903c7 --- /dev/null +++ b/src/wm_info_provider/dummy.rs @@ -0,0 +1,9 @@ +use super::*; + +pub struct DummyInfoProvider; + +impl WmInfoProvider for DummyInfoProvider { + fn as_any(&mut self) -> &mut dyn Any { + self + } +} diff --git a/src/wm_info_provider/hyprland.rs b/src/wm_info_provider/hyprland.rs index 1233e66..c754806 100644 --- a/src/wm_info_provider/hyprland.rs +++ b/src/wm_info_provider/hyprland.rs @@ -10,13 +10,13 @@ use crate::event_loop::{self, EventLoop}; use crate::state::State; use crate::utils::read_to_vec; -pub struct Hyprland { +pub struct HyprlandInfoProvider { ipc: Ipc, workspaces: Vec<IpcWorkspace>, active_id: u32, } -impl Hyprland { +impl HyprlandInfoProvider { pub fn new() -> Option<Self> { let his = std::env::var("HYPRLAND_INSTANCE_SIGNATURE").ok()?; let ipc = Ipc::new(&his).ok()?; @@ -28,7 +28,7 @@ impl Hyprland { } } -impl WmInfoProvider for Hyprland { +impl WmInfoProvider for HyprlandInfoProvider { fn register(&self, event_loop: &mut EventLoop) { event_loop.register_with_fd(self.ipc.sock2.as_raw_fd(), |ctx| { match hyprland_cb(ctx.conn, ctx.state) { |
