Add salemsayed/niri-active-workspace - #227
Merged
Merged
Conversation
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.
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.
Plugin
salemsayed/niri-active-workspaceplugin.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
workspaceswidget always renders one slot per workspace. Underniri 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_sizeshrinks inactive slots but bottoms out at0.25, so theycannot 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 independencies. The plugin API exposes no compositor state,so all workspace data comes from niri's IPC. The widget spawns
niri msgandnothing else:
niri msg --json workspaces— once at load, and again on a 60-second tick asa self-heal if the event stream dies.
niri msg --json event-stream— one long-lived subscription. OnlyWorkspacesChangedandWorkspaceActivatedare 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
pathplugin source on a single-monitor niri session:and updates live when switching workspaces (verified against
niri msg --json workspacesbefore and after).label_modevalues andshow_position.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 realconnector on this setup) and selects the workspace that is
is_activeon thatoutput, falling back to the globally
is_focusedone when the connector isunknown. 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.
856d99bbd199), packagenoctalia 5.0.0_beta.6-2Screenshots / Videos
The plugin card, which embeds a screenshot of the widget running in the bar —
the
demopill on the left is this widget, showing the focused workspace:Checklist
idafter the/inplugin.tomlexactly.plugin.toml,README.md,thumbnail.webp, andtranslations/en.json.README.mdfollows theREADME template, documents
every entry id and dependency, and includes exact panel IPC commands and launcher prefixes where applicable.
thumbnail.webpwith the thumbnail generator.versionfollows semver and is bumped in this PR;plugin_apiis the oldest API level this plugin requires.understand that language well enough to review and maintain it (no unreviewed machine/LLM translations).
catalog.toml; CI generates it.Code review attestation
licensedeclared inplugin.toml.