Skip to content

fix(rift): use workspace name for menu bar label, consistent with other backends - #4

Open
Hariketsu wants to merge 1 commit into
CCMurphy-dev:mainfrom
Hariketsu:fix/rift-workspace-label
Open

fix(rift): use workspace name for menu bar label, consistent with other backends#4
Hariketsu wants to merge 1 commit into
CCMurphy-dev:mainfrom
Hariketsu:fix/rift-workspace-label

Conversation

@Hariketsu

Copy link
Copy Markdown

Problem

With Rift as the window manager, workspace indicator labels are always the
raw 0-based index (0, 1, 2, 3…), even when the user has configured
workspace_names in Rift's config.toml. The configured names never surface
in the menu bar.

This is also an inconsistency across the three WM backends: the label
field of WMSpace exists precisely to carry the WM's workspace name —
AeroSpace maps ws.name to it (AeroSpaceAdapter.swift:50) and Yabai
decodes its per-space label straight into the model — and
SpaceIndicatorView is designed to prefer label over the index. The Rift
adapter is the only backend that drops the name, leaving Rift users with
bare indices while the other two backends show names.

Cause

RiftWorkspace.toWMSpace() in RiftAdapter.swift hardcodes the label from
the index and discards the name field that rift-cli query workspaces
already returns:

label: "\(index)",

Rift's workspace indices are 0-based internally (its own menu bar component
defaults to showing the index, and its CLI/commands are 0-based), so without
mapping name there is no way for configured names to appear.

Fix

Prefer the workspace name; fall back to the previous behavior (bare
index) when the name is empty:

label: name.isEmpty ? "\(index)" : name,

Display-only change: label is consumed by SpaceIndicatorView and context
menu strings. All workspace commands (focus, move-window) use the unchanged
index field, which RiftService converts back to 0-based when calling
rift-cli.

Compatibility note for reviewers

Rift auto-generates names (Workspace X) for workspaces not covered by
workspace_names, so name is effectively always non-empty. That means
users without custom names will see Workspace X instead of the bare index.
If you'd rather keep the bare index in that case, I can gate name display
behind a config option — let me know.

Testing

  • macOS 15, Apple Silicon, Rift backend auto-detected
  • With workspace_names = ["1", "2", "3", "4"] in config.toml, indicators
    display 1–4 instead of 0–3
  • Click-to-switch on each indicator still switches to the correct workspace
  • Live updates (workspace switch, window add/remove) unaffected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant