feat(niri-displays): add per-output enable/disable toggle - #665
Draft
jrohland wants to merge 2 commits into
Draft
Conversation
Each display card gains an "Enabled" toggle that runs `niri msg output <port> on|off`, reusing the existing runNiri wrapper so it inherits the in-flight lock, stderr surfacing, and refresh nonce. The last enabled output is protected: its toggle is locked and relabelled "Only display" so a session can never be left without a screen. Disabled outputs keep their card and stay togglable while their mode, rotation and scale controls remain greyed. Also resets the scale and position drafts when an output transitions back to enabled. A disabled output reports 0,0 geometry, and syncFromState only seeded positionDraft when it was nil, so re-enabling a display left the layout editor's Apply pointing at 0,0. No service change is required: normalizeOutputs already derives `enabled` from the JSON, and disabled outputs stay listed by `niri msg outputs`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
CC @raycursive: this pull request was automatically moved to draft until you have had a chance to look at it. It will be marked ready for review automatically once you reply here. |
The toggle was renamed from "Power" to "Enabled" to line up with Niri's own wording and the existing Disabled badge, but the README still described it as Power. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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
raycursive/niri-displaysplugin.toml)What it does
Adds a per-output Enabled toggle to each display card, so an output can be
switched off and back on without leaving Noctalia. It runs Niri's existing
temporary output IPC:
The last enabled output is protected — its toggle is locked and relabelled
"Only display", so a session can never be left without a screen. A disabled
output keeps its card and stays togglable, while its mode, refresh-rate,
rotation and scale controls remain greyed out.
This also fixes a latent draft bug the feature exposes: a disabled output
reports
0,0geometry, andsyncFromStateonly seededpositionDraftwhen itwas
nil, so re-enabling a display left the layout editor's Apply pointing at0,0. Drafts are now reset on the disabled → enabled transition.No service change was needed:
normalizeOutputsalready derivesenabledfromthe JSON, and disabled outputs stay listed by
niri msg outputswith"current_mode": null, "logical": null.External dependencies
None beyond the existing
niridependency already declared inplugin.toml.The only new command is
niri msg output <port> on|off, shell-quoted throughthe plugin's existing
quoteShellArgumentand dispatched via the existingrunNiriwrapper.Testing
Tested against a live 3-output Niri session (DP-1 5120x1440, DP-7 1920x1080,
eDP-1 disabled), with the plugin loaded from a local
pathplugin source.Verified
niri msg output eDP-1 on/offround-trips, withniri msg --json outputsshowinglogicalflipping between non-null andnull.Opened the panel and confirmed the Enabled toggle renders and reflects state
for both enabled and disabled outputs, and that a disabled output's other
controls stay greyed while its toggle stays live.
Dumped the service snapshot via
noctalia msg plugin raycursive/niri-displays:displays all dumpand confirmedenabledis correct per output.Ran the repo validator (
.github/workflows/scripts/validate-plugins.py) —clean.
Tested on Niri
Tested on Hyprland
Tested on Sway
Tested on another compositor:
Noctalia version tested against: v5.0.1
Plugin API level: 9
Screenshots / Videos
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.webpis present and relevant; for a new plugin I created it with the thumbnail generator, and for an update I regenerated it with the generator if the visual identity or user-facing appearance changed.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.