Skip to content

Add salemsayed/niri-active-workspace - #227

Merged
ItsLemmy merged 1 commit into
noctalia-dev:mainfrom
salemsayed:add-niri-active-workspace
Aug 3, 2026
Merged

Add salemsayed/niri-active-workspace#227
ItsLemmy merged 1 commit into
noctalia-dev:mainfrom
salemsayed:add-niri-active-workspace

Conversation

@salemsayed

Copy link
Copy Markdown
Contributor

Plugin

  • Id: salemsayed/niri-active-workspace
  • New plugin
  • Update to an existing plugin (version bumped in plugin.toml)

What it does

A bar widget that shows only the workspace you are currently on, instead of a
pill listing every workspace.

The built-in workspaces widget always renders one slot per workspace. Under
niri that is worse than elsewhere, because niri always keeps a trailing empty
workspace, so the pill permanently carries at least one slot with nothing in it.
inactive_pill_size shrinks inactive slots but bottoms out at 0.25, so they
cannot be hidden. This widget renders a single label and moves the full list
into the tooltip.

The label is the workspace name, falling back to its index when unnamed. Left
click toggles the niri overview; scrolling moves between workspaces. The tooltip
lists every workspace on the same monitor with the focused one marked.

External dependencies

niri — declared in dependencies. The plugin API exposes no compositor state,
so all workspace data comes from niri's IPC. The widget spawns niri msg and
nothing else:

  • niri msg --json workspaces — once at load, and again on a 60-second tick as
    a self-heal if the event stream dies.
  • niri msg --json event-stream — one long-lived subscription. Only
    WorkspacesChanged and WorkspaceActivated are handled.
  • niri msg action toggle-overview / focus-workspace-down /
    focus-workspace-up — only in response to a click or scroll.

No network access. No filesystem reads or writes. State is kept in memory.

Testing

Ran as a local path plugin source on a single-monitor niri session:

  • Added the widget to the bar; confirmed it renders the focused workspace name
    and updates live when switching workspaces (verified against
    niri msg --json workspaces before and after).
  • Confirmed the tooltip lists all workspaces with the focus marker.
  • Exercised left click (overview) and scroll (workspace switching).
  • Checked all four label_mode values and show_position.
  • Confirmed the widget survives a plugin reload and that the 60-second
    re-snapshot path runs.

Not tested: multiple monitors. I only have one output. The widget resolves
its own connector via barWidget.outputName() (confirmed returning a real
connector on this setup) and selects the workspace that is is_active on that
output, falling back to the globally is_focused one when the connector is
unknown. On a single monitor those are the same workspace, so the divergent
branch is unexercised. Review of that path — or a quick check by someone with
two outputs — is welcome.

  • Tested on Niri
  • Tested on Hyprland
  • Tested on Sway
  • Tested on another compositor:
  • Noctalia version tested against: v5.0.0 (856d99bbd199), package noctalia 5.0.0_beta.6-2
  • Plugin API level: 3

Screenshots / Videos

The plugin card, which embeds a screenshot of the widget running in the bar —
the demo pill on the left is this widget, showing the focused workspace:

Niri Active Workspace

Checklist

  • The directory name matches the part of id after the / in plugin.toml exactly.
  • It ships plugin.toml, README.md, thumbnail.webp, and translations/en.json.
  • README.md follows the
    README template, documents
    every entry id and dependency, and includes exact panel IPC commands and launcher prefixes where applicable.
  • I created thumbnail.webp with the thumbnail generator.
  • version follows semver and is bumped in this PR; plugin_api is the oldest API level this plugin requires.
  • Every non-English translation in this PR uses a locale supported by Noctalia core, and I can read, write, and
    understand that language well enough to review and maintain it (no unreviewed machine/LLM translations).
  • I did not edit catalog.toml; CI generates it.
  • This PR touches exactly one plugin directory.

Code review attestation

  • The code is readable and not obfuscated, minified, or generated.
  • It does not download and execute remote code.
  • Every network call, filesystem write, and spawned process is something the description above accounts for.
  • I have the right to publish this code under the license declared in plugin.toml.

A bar widget showing only the focused niri workspace instead of a pill
listing every workspace. Reads niri IPC (snapshot plus event-stream)
since the plugin API exposes no compositor state.
@ItsLemmy
ItsLemmy merged commit 1c2db1c into noctalia-dev:main Aug 3, 2026
3 checks passed
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.

2 participants