summaryrefslogtreecommitdiff
path: root/src/wm_info_provider/hyprland.rs
diff options
context:
space:
mode:
authorvpzomtrrfrt <colin@vpzom.click>2024-09-07 12:03:42 -0600
committerGitHub <noreply@github.com>2024-09-07 21:03:42 +0300
commitbaca06fc3a666f41c070119b76b6838f75d47eb7 (patch)
tree3de45876384a5f69e55e3088c4ec90309c5fea07 /src/wm_info_provider/hyprland.rs
parent78d92a783357bf9bfb3f9584a13dd1d64424a9d0 (diff)
downloadi3bar-mango-baca06fc3a666f41c070119b76b6838f75d47eb7.tar.gz
hyprland: Also trigger workspace update on focusedmon (#34)
Diffstat (limited to 'src/wm_info_provider/hyprland.rs')
-rw-r--r--src/wm_info_provider/hyprland.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wm_info_provider/hyprland.rs b/src/wm_info_provider/hyprland.rs
index 6fbfc30..29b86b3 100644
--- a/src/wm_info_provider/hyprland.rs
+++ b/src/wm_info_provider/hyprland.rs
@@ -83,6 +83,15 @@ fn hyprland_cb(conn: &mut Connection<State>, state: &mut State) -> io::Result<()
.parse()
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
updated = true;
+ } else if let Some(data) = event.strip_prefix("focusedmon>>") {
+ let (_monitor, active_ws) = data.split_once(',').ok_or_else(|| {
+ io::Error::new(io::ErrorKind::InvalidData, "Too few fields in data")
+ })?;
+
+ hyprland.active_id = active_ws
+ .parse()
+ .map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?;
+ updated = true;
} else if event.contains("workspace>>") {
hyprland.workspaces = hyprland.ipc.query_sorted_workspaces()?;
updated = true;