From fa9135b5d1a459f91ac47f5c03214d836475473c Mon Sep 17 00:00:00 2001 From: MaxVerevkin Date: Mon, 17 Apr 2023 13:38:20 +0300 Subject: ext_workspace_unstable: send activate request even though it is ignored by hyprland --- src/pointer_btn.rs | 2 +- src/wm_info_provider/ext_workspace_unstable.rs | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/pointer_btn.rs b/src/pointer_btn.rs index 829fc9c..e5e0722 100644 --- a/src/pointer_btn.rs +++ b/src/pointer_btn.rs @@ -10,7 +10,7 @@ const BTN_FORWARD: u32 = 0x115; const BTN_BACK: u32 = 0x116; // const BTN_TASK: u32 = 0x117; -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum PointerBtn { Left, Middle, diff --git a/src/wm_info_provider/ext_workspace_unstable.rs b/src/wm_info_provider/ext_workspace_unstable.rs index 68238d0..dbf6bf7 100644 --- a/src/wm_info_provider/ext_workspace_unstable.rs +++ b/src/wm_info_provider/ext_workspace_unstable.rs @@ -57,12 +57,23 @@ impl ExtWorkspaceUnstable { pub fn click_on_tag( &mut self, - _: &mut Connection, + conn: &mut Connection, _: WlOutput, _: WlSeat, - _: &str, - _: PointerBtn, + tag: &str, + btn: PointerBtn, ) { + if btn != PointerBtn::Left { + return; + } + + let Some(ws) = self + .groups + .iter() + .find_map(|g| g.workspaces.iter().find(|w| w.name.as_deref() == Some(tag))) + else { return }; + + ws.workspace_handle.activate(conn); } } -- cgit v1.3.1