From caa6189448cbf338c18fe6afe313f577c8378b31 Mon Sep 17 00:00:00 2001 From: Duncan Overbruck Date: Fri, 21 Mar 2025 17:48:47 +0100 Subject: add workspace urgency ipc event --- niri-ipc/src/lib.rs | 9 +++++++++ niri-ipc/src/state.rs | 7 +++++++ 2 files changed, 16 insertions(+) (limited to 'niri-ipc') diff --git a/niri-ipc/src/lib.rs b/niri-ipc/src/lib.rs index 75d9a543..fcb2d1ff 100644 --- a/niri-ipc/src/lib.rs +++ b/niri-ipc/src/lib.rs @@ -1150,6 +1150,8 @@ pub struct Workspace { /// /// Can be `None` if no outputs are currently connected. pub output: Option, + /// Whether the workspace currently has an urgent window in its output. + pub is_urgent: bool, /// Whether the workspace is currently active on its output. /// /// Every output has one active workspace, the one that is currently visible on that output. @@ -1224,6 +1226,13 @@ pub enum Event { /// workspaces are missing from here, then they were deleted. workspaces: Vec, }, + /// The workspace urgency changed. + WorkspaceUrgencyChanged { + /// Id of the workspace. + id: u64, + /// Whether this workspace has an urgent window. + urgent: bool, + }, /// A workspace was activated on an output. /// /// This doesn't always mean the workspace became focused, just that it's now the active diff --git a/niri-ipc/src/state.rs b/niri-ipc/src/state.rs index 0689104d..9edeeabf 100644 --- a/niri-ipc/src/state.rs +++ b/niri-ipc/src/state.rs @@ -103,6 +103,13 @@ impl EventStreamStatePart for WorkspacesState { Event::WorkspacesChanged { workspaces } => { self.workspaces = workspaces.into_iter().map(|ws| (ws.id, ws)).collect(); } + Event::WorkspaceUrgencyChanged { id, urgent } => { + for ws in self.workspaces.values_mut() { + if ws.id == id { + ws.is_urgent = urgent; + } + } + } Event::WorkspaceActivated { id, focused } => { let ws = self.workspaces.get(&id); let ws = ws.expect("activated workspace was missing from the map"); -- cgit