Skip to content

niri: event-stream watcher to keep the agent workspace pinned at the bottom #6

Description

@Kabilan108

Deferred from the 2026-07-07 overnight niri-computer-use rebuild — revisit after living with the current setup for a few days.

Problem

The named "agent" workspace (background staging area for acu spawn --bg) is pushed to the bottom of the workspace list at session start (move-workspace-to-index 9 --reference agent in config.kdl). But niri's dynamic workspaces materialize from the trailing empty slot below it, so the agent workspace can drift up one position mid-session. Cosmetic only: Mod+0 targets it by name and stillsuit shows it as a mauve dot, so the index no longer matters for muscle memory.

Proposed fix (if the drift ends up annoying)

A ~40-line watcher (bin/agent-workspace-pin + systemd user unit, PartOf=graphical-session.target, Restart=on-failure):

  1. Subscribe to niri msg -j event-stream; react only to WorkspacesChanged.
  2. Invariant: agent workspace sits second-to-last on its output (right above niri's permanent trailing empty workspace).
  3. On drift: niri msg action move-workspace-to-index 9 --reference agent. Converges in one step (the corrective move's own event passes the check); idempotent if races occur.
  4. Intent heuristic so it never fights a human: keep the previous snapshot — re-pin only when the workspace count changed (drift case); if only the agent's index changed at constant count, that was a manual drag, leave it alone until next session.

Reliability notes: the event stream is the same feed stillsuit's bar consumes all day; niri dumps full state on every stream connect, so restart/reconnect can't miss drift.

Context

Built in Claude Code session 6522abba-e061-4616-8a64-131afea9f27c (transcript lands in ~/.local/share/tracer/archive/claude/dotfiles/6522abba-e061-4616-8a64-131afea9f27c.md once archived). Full environment findings: agents/skills/niri-computer-use/references/environment.md. Relevant commits: 994b0ee..596f508.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions