From 2da90fc625725c6d3465c920826e2718579cfb40 Mon Sep 17 00:00:00 2001 From: MaxVerevkin Date: Wed, 12 Apr 2023 12:05:08 +0300 Subject: WIP: hyprland support --- src/wm_info_provider.rs | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'src/wm_info_provider.rs') diff --git a/src/wm_info_provider.rs b/src/wm_info_provider.rs index 12e4fb8..7f2d941 100644 --- a/src/wm_info_provider.rs +++ b/src/wm_info_provider.rs @@ -1,3 +1,4 @@ +mod ext_workspace_unstable; mod river; use wayrs_client::connection::Connection; @@ -6,10 +7,13 @@ use wayrs_client::global::*; use crate::pointer_btn::PointerBtn; use crate::protocol::*; use crate::state::State; +use ext_workspace_unstable::*; +use river::*; pub enum WmInfoProvider { None, - River(river::RiverInfoProvider), + River(RiverInfoProvider), + EWU(ExtWorkspaceUnstable), } pub type WmInfoCallback = fn(&mut Connection, &mut State, WlOutput, WmInfo); @@ -20,21 +24,28 @@ impl WmInfoProvider { globals: &Globals, callback: WmInfoCallback, ) -> WmInfoProvider { - let Some(river) = river::RiverInfoProvider::bind(conn, globals, callback) else { return Self::None }; - Self::River(river) + if let Some(river) = RiverInfoProvider::bind(conn, globals, callback) { + Self::River(river) + } else if let Some(ext_wp_u) = ExtWorkspaceUnstable::bind(conn, globals, callback) { + Self::EWU(ext_wp_u) + } else { + Self::None + } } pub fn new_ouput(&mut self, conn: &mut Connection, output: WlOutput) { match self { Self::None => (), - Self::River(river) => river.new_output(conn, output), + Self::River(x) => x.new_output(conn, output), + Self::EWU(x) => x.new_ouput(conn, output), } } pub fn output_removed(&mut self, conn: &mut Connection, output: WlOutput) { match self { Self::None => (), - Self::River(river) => river.output_removed(conn, output), + Self::River(x) => x.output_removed(conn, output), + Self::EWU(x) => x.output_removed(conn, output), } } @@ -48,17 +59,19 @@ impl WmInfoProvider { ) { match self { Self::None => (), - Self::River(river) => river.click_on_tag(conn, output, seat, tag, btn), + Self::River(x) => x.click_on_tag(conn, output, seat, tag, btn), + Self::EWU(x) => x.click_on_tag(conn, output, seat, tag, btn), } } } -#[derive(Default)] +#[derive(Default, Debug)] pub struct WmInfo { pub layout_name: Option, pub tags: Vec, } +#[derive(Debug)] pub struct Tag { pub name: String, pub is_focused: bool, -- cgit v1.3.1