aboutsummaryrefslogtreecommitdiff
path: root/niri-ipc/src
diff options
context:
space:
mode:
authorDuncan Overbruck <mail@duncano.de>2025-03-21 17:48:47 +0100
committerIvan Molodetskikh <yalterz@gmail.com>2025-05-10 12:14:41 -0700
commitcaa6189448cbf338c18fe6afe313f577c8378b31 (patch)
tree97ce7ecb2a94481639e0251c7ce1d3daf27e51cb /niri-ipc/src
parent86f57c2ec775d4aa08bf310c94b22ea266eaa9e9 (diff)
downloadniri-caa6189448cbf338c18fe6afe313f577c8378b31.tar.gz
niri-caa6189448cbf338c18fe6afe313f577c8378b31.tar.bz2
niri-caa6189448cbf338c18fe6afe313f577c8378b31.zip
add workspace urgency ipc event
Diffstat (limited to 'niri-ipc/src')
-rw-r--r--niri-ipc/src/lib.rs9
-rw-r--r--niri-ipc/src/state.rs7
2 files changed, 16 insertions, 0 deletions
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<String>,
+ /// 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<Workspace>,
},
+ /// 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");