feat(workspace): add workspace alert IPC#3134
Open
khughitt wants to merge 1 commit into
Open
Conversation
Adds a self-contained workspace-alert feature: users can flag a workspace (or the workspace containing a given window) so it renders with the urgent style until they switch to it. Alerts are matched against a workspace's user-addressable identifiers -- its id, name, or visible index -- because compositors populate different ones (niri only sets the visible index; Sway uses the name; tag compositors use the numeric id). The overlay reuses the urgent flag in CompositorPlatform::workspaces(), keeping the change confined to the service, the IPC handlers, one overlay hook, and the focused-output auto-clear wiring -- no per-backend changes. IPC commands: workspace-alert-add, workspace-alert-add-window, workspace-alert-clear, workspace-alert-clear-all, workspace-alert-status. Limitation: none of these identifiers is unique across outputs on compositors that number workspaces per monitor (niri index, mango/dwl tags), so an alert there applies to the matching workspace on every output. Documented in the service header.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Adds a workspace-alert feature. Over IPC, a user can flag a workspace — or the workspace containing a given window — so it renders with the existing
urgentstyle until they switch to it. The alert auto-clears when the user activates that workspace.IPC commands:
workspace-alert-add <workspace-id>workspace-alert-add-window <window-id>workspace-alert-clear <workspace-id>workspace-alert-clear-allworkspace-alert-statusWhy this is a rewrite of #3025
The original PR (#3025) was declined on scope: it introduced a new canonical
Workspace.keyfield and threaded it through all seven compositor backends — the highest-maintenance surface in the project — plus output-name-resolver plumbing and widget/snapshot changes.This version reuses the compositor's existing workspace identifiers as the alert token, so the feature collapses to a self-contained unit:
WorkspaceAlertService(set of tokens + overlay logic),CompositorPlatform::workspaces()overload,An alert token is matched against a workspace's id, name, or visible index, because backends populate different ones (niri only sets the visible index; Sway uses the name as the id; tag compositors use the numeric id). This keeps the feature usable across compositors without threading a new canonical key through every backend. No per-backend changes. The only cross-cutting edit is relocating the plain
WorkspaceWindowAssignmentstruct between two headers.Known limitation
None of these identifiers is guaranteed unique across outputs on compositors that number workspaces per monitor (niri index, mango/dwl tags), so an alert there applies to the matching workspace on every monitor (and activating it on any monitor clears it). This is the accepted per-output trade-off for not introducing a per-backend canonical key; it's documented in the service header.
Notes
urgentflag and only marks inactive rows, so alerting the active workspace simply shows once you leave it and clears on return; on per-output compositors this also lets an inactive duplicate alert even when the same workspace is active on another monitor.apply()inworkspaces(), so the visible index is populated at match time (this is what makes niri — which doesn't expose a usableid— work).m_workspaceAlertServiceis declared beforem_compositorPlatformso the raw pointer handed to the platform outlives it.Testing
just buildpasses.workspace_alert_serviceunit test: 31/31 (covers overlay suppression of active rows, matching by index/name/id, per-output duplicate-index handling, window→workspace resolution, and validation).workspace-alert-add <n>by visible number,add-window <id>,clear,clear-all, andstatusall behave as expected.git diff --checkclean.