From f861e02d7e026cc0e4c05aae6d98719367dfef37 Mon Sep 17 00:00:00 2001 From: Colin Reeder Date: Fri, 6 Sep 2024 01:21:07 -0600 Subject: [PATCH] Also trigger workspace update on focusedmon --- src/wm_info_provider/hyprland.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/wm_info_provider/hyprland.rs b/src/wm_info_provider/hyprland.rs index bbef98b..f91efb7 100644 --- a/src/wm_info_provider/hyprland.rs +++ b/src/wm_info_provider/hyprland.rs @@ -81,6 +81,18 @@ fn hyprland_cb(conn: &mut Connection, state: &mut State) -> io::Result<() match hyprland.ipc.next_event() { Ok(event) => { if let Some(active_ws) = event.strip_prefix("workspace>>") { + hyprland.active_id = active_ws + .parse() + .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?; + updated = true; + } else if let Some(data) = event.strip_prefix("focusedmon>>") { + let active_ws = data + .split_once(',') + .ok_or_else(|| { + io::Error::new(io::ErrorKind::InvalidData, "Too few fields in data") + })? + .1; + hyprland.active_id = active_ws .parse() .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;