repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

fix(nuguland): track workspace switches in the bar

e2dde7392139a06457c6f2459c5c032efd0b1851

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

niri emits WorkspaceActivated {id, focused} on a workspace switch, not a
full WorkspacesChanged — which applyEvent ignored, so the bar never
updated is_focused/is_active. Handle it: set is_active per-output and
is_focused globally for the activated workspace.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Changed files (1)

quickshell/nuguland/Niri.qml

Modified
276 276 if (event.WorkspacesChanged)
277 277 workspaces = event.WorkspacesChanged.workspaces || [];
279 + if (event.WorkspaceActivated) {
280 + const activatedId = event.WorkspaceActivated.id;
281 + const focused = !!event.WorkspaceActivated.focused;
282 + let activatedOutput = null;
283 + for (let i = 0; i < workspaces.length; i++) if (workspaces[i].id === activatedId)
284 + activatedOutput = workspaces[i].output;
286 + workspaces = workspaces.map((ws) => {
287 + const next = Object.assign({
288 + }, ws);
289 + if (ws.output === activatedOutput)
290 + next.is_active = ws.id === activatedId;
292 + if (focused)
293 + next.is_focused = ws.id === activatedId;
295 + return next;
296 + });
279 298 if (event.WindowsChanged)
280 299 windows = event.WindowsChanged.windows || [];