Skip to content

Control any display from the display panel, not just the one you are on - #6710

Open
vivek7405 wants to merge 15 commits into
omacom:quattrofrom
vivek7405:per-display-controls
Open

vivek7405 wants to merge 15 commits into
omacom:quattrofrom
vivek7405:per-display-controls

Conversation

@vivek7405

@vivek7405 vivek7405 commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Currently, the display panel only controls the focused monitor where the panel is open, and lacks a way to turn displays off. This update adds support for both capabilities and fixes a few existing bugs encountered along the way.

DP-7 Screen Capture

The Changes

  1. Adjust any display's settings without going to it. Click a row to select a
    display, and brightness and scale then apply to it. The focused display is
    selected by default, so nothing changes if you ignore the selector.
  2. Switch a display off and on with a toggle on each row. Not offered for the
    focused display or the last one left on, since turning off the screen you are
    looking at leaves nothing to turn it back on with. SUPER + CTRL + Delete still
    toggles the laptop display, an existing switched-off laptop panel carries
    over, and the boot-time rescue still clears it.
  3. Fix a scale persisting to every display instead of the one it was set for
    ([Quattro] Display panel scale is per-monitor at runtime but persists globally, rescaling other monitors on reload #6673).
  4. Fix omarchy-display-text-size reporting the wrong terminal's font size,
    and exiting non-zero when Foot is running.
  5. Fix mirroring undoing itself a second or two after being switched on. Fixed upstream by fix(monitor): fix display mirroring recovery and UI state #6457, so this is no longer part of the change.

#6673

Scale was applied per display but persisted to the catch-all rule, which speaks
for every display, and writing the config trips Hyprland's auto-reload. So on a
stock monitors.lua: set A to 2, set B to 1.6, and A becomes 1.6 a second later.

A scale now goes to a rule for the display it was chosen for. Only the scale
value is touched and the identifier the user wrote is kept, because a rule that
omits position does not inherit one from the catch-all and would silently
rearrange a pinned layout. Two knock-on effects: a catch-all-only config gains
per-display rules on first use, and omarchy_monitor_scale is no longer what the
panel moves.

The new helper

bin/omarchy-hyprland-monitor-config is sourced by two commands that both read
monitors.lua. Clamshell recovery reads a display's scale and position, and
scaling writes a scale back. The parser from #6688 moved into it unchanged so
both agree on what a rule is. Precedent: omarchy-bar sources
omarchy-shell-config.

Settings go to the user's own monitors.lua. A display switched off at runtime
goes to the toggles layer, next to the existing laptop-panel flag. Nothing here
computes layout or holds state Hyprland already holds.

The mirror command

A mirrored output is not an independent one, so Hyprland leaves it out of
hyprctl monitors. The shared check for whether an external display is still
connected read that listing, so a display vanished from it the instant mirroring
engaged, and the recovery cleared the mirror flag on the assumption the cable had
been pulled. Succeeding is what made it fail. monitors all lists connected
outputs whether or not they are mirroring, and still omits one that is genuinely
unplugged, which is the case the recovery is there for.

Two smaller adaptations go with the toggle. Turning mirroring on clears any
disable on the laptop panel, and that clear now goes through the overrides so it
finds the setting wherever it is recorded. Switching a display back on
underneath a mirror cycles mirroring as plumbing, so those callers pass --quiet
and a single toggle does not stack up notifications.

Testing

./test/shell, plus by hand with two displays: select the other display and move
the scale slider (only it rescales), hyprctl reload (both keep their own
scale), toggle it off and on (focus does not move), and switch mirroring on from
the menu (it stays on). Checked on a laptop panel plus an external monitor.

Copilot AI balanced review requested due to automatic review settings August 11, 2026 15:20
@vivek7405
vivek7405 marked this pull request as draft August 11, 2026 15:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds cross-display controls to the display panel, including per-monitor scaling, brightness, and power toggles. It also improves monitor recovery, mirroring, and terminal text-size reporting.

Changes:

  • Adds display selection and enable/disable controls.
  • Persists scaling and disabled state per display.
  • Adds migration, recovery, and regression coverage.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 13 out of 24 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
shell/plugins/panels/monitor/Panel.qml Adds display selection and toggles.
shell/plugins/panels/monitor/Model.js Compares display-state snapshots.
bin/omarchy-monitor-state Reports state for a selected monitor.
bin/omarchy-hyprland-monitor-toggle Implements display power toggling.
bin/omarchy-hyprland-monitor-scaling Targets and persists per-monitor scale.
bin/omarchy-hyprland-monitor-config Adds shared monitor-config helpers.
bin/omarchy-hyprland-monitor-override Persists generated display overrides.
bin/omarchy-hyprland-monitor-clamshell Uses shared configuration parsing.
bin/omarchy-hyprland-monitor-internal Moves internal-display state to overrides.
bin/omarchy-hyprland-monitor-internal-mirror Improves mirror recovery and notifications.
bin/omarchy-hyprland-monitor-external-active Recognizes mirrored external outputs.
bin/omarchy-hw-recover-internal-monitor Recovers disabled panels before startup.
bin/omarchy-display-text-size Reports the configured default terminal.
migrations/1786439048.sh Migrates legacy disabled-panel state.
default/systemd/user/omarchy-recover-internal-monitor.service Runs recovery without a stale condition.
test/shell.d/monitor-toggle-test.sh Tests display toggling and guards.
test/shell.d/monitor-test.sh Tests display-list equality.
test/shell.d/monitor-scaling-test.sh Tests targeted scale persistence.
test/shell.d/monitor-recovery-test.sh Tests recovery integration.
test/shell.d/monitor-override-test.sh Tests override storage and rendering.
test/shell.d/monitor-clamshell-scale-test.sh Updates clamshell fixtures.
test/shell.d/display-text-size-test.sh Tests terminal-size reporting.
test/shell.d/display-overrides-migration-test.sh Tests migration safety.
test/acceptance.d/display-recovery-test.sh Verifies installed recovery behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread shell/plugins/panels/monitor/Panel.qml Resolved
@vivek7405
vivek7405 marked this pull request as ready for review August 11, 2026 15:48
Copilot AI review requested due to automatic review settings August 11, 2026 15:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 24 changed files in this pull request and generated no new comments.

Suppressed comments (1)

shell/plugins/panels/monitor/Panel.qml:382

  • The shared actionProc drops commands while it is running: both functions overwrite command, but running remains true and completion only refreshes state. Enabling a monitor can run for several seconds, so a scale change or another toggle during that interval never executes. Queue the latest action (as the state/brightness processes do) or mark all action controls busy without overwriting the in-flight command.
    actionProc.command = ["omarchy-hyprland-monitor-toggle", name, enabled ? "off" : "on"]
    if (!actionProc.running) actionProc.running = true
  }

  function setScale(scale) {
    actionProc.command = ["omarchy-hyprland-monitor-scaling", "--monitor", root.targetMonitor(), String(scale)]
    if (!actionProc.running) actionProc.running = true

Copilot AI review requested due to automatic review settings August 11, 2026 16:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 24 changed files in this pull request and generated no new comments.

Suppressed comments (3)

shell/plugins/panels/monitor/Panel.qml:297

  • Queued brightness updates do not retain the display they were intended for. If a second adjustment is queued for display A and the user selects display B before the in-flight write finishes, setBrightness() is called again and builds the command from the now-current targetMonitor(), so A's pending value is sent to B. Store the target monitor together with the pending percentage (or serialize per-monitor commands) and use that captured target when draining the queue.
    if (setBrightnessProc.running) {
      root.brightnessSetQueued = true
      return
    }

    root.brightnessSetQueued = false
    setBrightnessProc.command = ["omarchy-brightness-display", "--no-osd", "--monitor", root.targetMonitor(), percent + "%"]

shell/plugins/panels/monitor/Panel.qml:847

  • This visibility check treats every enabled entry from monitors all as independently scalable, but mirrored outputs are enabled in that listing while absent from plain hyprctl monitors. Selecting such a row leaves SCALE visible, then omarchy-hyprland-monitor-scaling --monitor rejects it and the panel silently does nothing. Carry an independent/mirrored flag in the display model and hide or disable scale controls for outputs the scaling command cannot target.
          Column {
            width: parent.width
            spacing: Style.space(10)
            // A dark display has no mode to scale, and the command refuses a
            // display Hyprland is not driving.
            visible: !root.selectedDisplay || root.selectedDisplay.enabled

migrations/1786439048.sh:30

  • This failure path exits successfully, so omarchy-migrate immediately creates the migration marker and never retries the failed transfer. Although retaining the legacy flag preserves current behavior, the state migration remains permanently incomplete after a transient/no-op write. Leave the flag in place but return non-zero so the migration remains pending.
if [[ $(omarchy-hyprland-monitor-override get "$internal" disabled) != "true" ]]; then
  echo "  could not record $internal as switched off, leaving $flag in place"
  exit 0

Copilot AI review requested due to automatic review settings August 11, 2026 16:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 24 changed files in this pull request and generated no new comments.

The display panel's rows called `hyprctl keyword`, which Hyprland's Lua
parser rejects outright, so clicking one did nothing in either direction and
said nothing about it. Only the laptop panel could be switched off at all,
and only from a keybinding.

Any display can now be switched off, through a command that applies the
change and records it. A display is refused when it is the one being looked
at or the last one lit, because switching off the display you are reading
leaves no pointer and no obvious way back.

Bringing a display back also made Hyprland move focus onto it a moment later,
and could leave it with no active workspace at all — a display with no
workspace draws nothing until something selects one, which is why closing a
panel appeared to fix it. Both are put back afterwards.

State lives in the toggles directory Omarchy already keeps such things in,
keyed by EDID description where a display reports one, so switching a display
off follows the display rather than the port it is plugged into.
Turning mirroring on clears any disable on the laptop panel first, since
mirroring to a display that is switched off shows nothing. That clear went
straight at the old flag file, which no longer holds the whole answer: a display
switched off from the panel is recorded in the display overrides instead. So ask
the overrides to clear it, wherever it happens to be written.

Switching a display back on underneath a mirror has to cycle mirroring to
rebuild the output, which is plumbing rather than anything the user asked for.
Those callers pass --quiet so a single toggle does not stack up notifications
about mirroring being enabled and extended mode being restored.
A laptop panel switched off while docked and then undocked boots to a dark
screen, and the only thing that brings it back is the boot-time recovery
reading where that state is kept. So the move is staged: the readers already
accept both locations, and the migration writes the new record, reads it
back, and only then removes the old file — an interrupted run leaves the
machine exactly as it was rather than switched off with nothing saying so.

The recovery unit drops its condition rather than pointing it at the new
location. It named the file the migration deletes, and a condition that stops
matching disables the rescue silently: systemd reports a skipped unit as
having succeeded, so nothing would have looked wrong.

The rescue runs before the graphical session, where there is no compositor to
ask, so it reads the connector straight from DRM and clears every location a
disable can live in — an un-migrated, half-migrated and migrated machine all
recover the same way.
Brightness and scale could only be changed for whichever display had focus,
so adjusting a second monitor meant walking over to it and opening the panel
there. Both commands now take the display to act on, defaulting to the
focused one as before.

Scaling keeps what it had otherwise: it places with "auto" and persists the
stock default, because working out where displays should sit after a size
change means re-deriving geometry the compositor already holds, and
recording a scale per display means rewriting rules the user wrote
themselves. What it gains is a guard — that stock default describes every
display, so only the focused display may write it. Without that, scaling a
display you are not using would resize the one you are, on the next reload.

An unresolvable display name is refused rather than passed through: an empty
output is Hyprland's catch-all, so it would have rescaled every display
instead of none.
Every control acted on whichever display had focus, so the panel could only
ever adjust the display it was opened from, and the display list at the
bottom was a set of unmarked click targets that did nothing.

Picking a row now selects that display and points brightness and scale at it,
with the headers naming what they are about to change. Each row carries a
switch for turning its display off, dimmed where that is refused, so what is
possible is visible rather than discovered by clicking. Selection is
deliberate: hovering a row does not retarget the controls, since whatever the
pointer happened to be over when the panel opened would otherwise decide.

Text size stays labelled as covering every display, because it drives the
shell font, GTK text scaling and terminal size together and cannot be per
display.

The rows are also left alone when a state read describes what is already on
screen. The panel re-reads every few seconds, and rebuilding the list
destroys the switch under the pointer mid-click.
The reported terminal size came from whichever terminal config existed first
on disk. On a machine with several installed that was always Ghostty, however
wrong — it read nine points while the terminal in use sat at twelve, which
made the setting look broken when it was working. It now asks which terminal
the system actually launches.

Setting a size also exited non-zero whenever Foot was running, because a
conditional was the last statement in the function that writes the terminal
configs and its result became the exit status.
Scaling a display had no lasting effect whenever that display had a rule of its
own. Only the shipped catch-all was ever rewritten, and a rule naming one
display overrides a rule naming none, so the value written was one Hyprland
would never apply.

It was worse than failing to persist. Writing the config reloads Hyprland, the
reload re-applies every rule, and the rule still carrying the old scale won. The
change was undone about a second after it was made, which reads as a scale that
refuses to change rather than one that does not survive a reboot.

So write the scale where it will be read: into the display's own rule, changing
that one value and leaving the mode, the position and the identifier the user
chose exactly as written. Replacing the rule instead is not an option, since a
rule that omits a position does not inherit one from the catch-all and the
display is re-placed the next time the config loads.

A display with no rule of its own keeps the previous behaviour when it is the
one the user is on: the generic default is theirs to move. Targeted from the
selector it gains a rule of its own, because the catch-all speaks for every
display and moving it would resize the rest. GDK_SCALE serves the whole session,
so only a change to the display the user is on redefines it.

Identifiers are matched the way Hyprland matches them, `desc:` by prefix, so an
abbreviated description still names its display. Comments are cut before
anything is matched, or the commented examples the config ships with would be
rewritten in place of the real rule.
A monitors.lua whose last line has no trailing newline took the appended rule
onto the end of that line. The result is not valid Lua, and a config that does
not parse takes the session's whole monitor configuration down with it.
Clamshell recovery reads a display's configured scale and position out of
monitors.lua, and the scaling command needs to write a scale back into the same
file. Two readers of one config drift: one learns that a commented line is not a
rule, or that a bare word may name a local, while the other does not.

Both drifts fail quietly. A rule matched too loosely rewrites a comment and
leaves the real configuration untouched. A rule missed entirely writes a value
Hyprland never applies, and the write reloads the compositor, which puts the old
value straight back.

So the parsing moves to one sourced file, together with the edits that act on
what it finds. Nothing about how a rule is recognised changes here. Sourcing a
command for its helpers is how omarchy-bar already uses omarchy-shell-config.
Setting a scale wrote it to the catch-all rule, which speaks for every display.
With more than one display connected the value landed on all of them, and since
writing the config reloads Hyprland, it landed within a second or so of being
chosen. Scaling each display in turn left them all at whichever was picked last.

A scale now goes to a rule for the display it was chosen for: rewriting that
display's rule when it has one, giving it one when it does not. The catch-all is
left to speak for the displays nobody has said anything specific about.

GDK_SCALE is still written only for the display the user is on, because one
value serves the whole session and a display being adjusted from across the desk
has no claim on it.
The panel refused to start a state read while one was already running. That read
was started for whichever display was selected when it began, so a selection
made while it was in flight left the previous display's brightness and scale
sitting under the new display's name until the five second poll corrected it.

Adjusting brightness in that window was worse than a stale label: the value
shown belonged to the old display, and setting it sent that value to the newly
selected one.

Queue the request and run it once the reader stops, which is what the brightness
setter next to it already does with its own queued flag.
One process serves both the row toggles and the scale buttons. Assigning it a
command while it was already running neither started that command nor left
anything to start it afterwards, so the request was lost without a word.

The window is not a narrow one. Switching a display on rebuilds the output and
waits for it to settle, which takes seconds, and a scale picked during that
simply did not happen. The panel re-reads state every few seconds, so it
corrected itself and the click looked like it had done nothing at all.

Hold the most recent request and run it when the process stops, which is what
the state read and the brightness setter beside it already do. The refresh that
follows an action waits for the queue to drain, so it describes the state the
user actually asked for rather than an intermediate one.
The queue kept the percentage but not the display. Draining it called the setter
again, which resolved the target afresh, so a value queued for one display was
sent to whichever was selected by the time the write finished. Selecting another
display mid-adjustment was enough to do it.

Settle the display when the change is made, and carry it alongside the value.
A display that mirrors another is enabled, and the panel listed it as such, so
selecting its row offered the scale controls. Every press was then refused,
because the scaling command only accepts a display Hyprland drives as an output
of its own, and a mirroring display is not one. Nothing said so.

The two listings disagree on purpose: `monitors all` includes such a display and
plain `monitors` does not. Carry that distinction into the panel's display list
as `driven`, separate from `enabled`, and show the scale controls only for a
display that can actually take one.
Copilot AI review requested due to automatic review settings August 11, 2026 17:26
@vivek7405
vivek7405 force-pushed the per-display-controls branch from 358169e to e424c0d Compare August 11, 2026 17:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 23 changed files in this pull request and generated no new comments.

Suppressed comments (1)

shell/plugins/panels/monitor/Panel.qml:380

  • On reopening the panel, selectedMonitor is cleared before the asynchronous refresh, but this fallback retains focusedMonitor from the previous open. An immediate scale or brightness action can therefore target the display that used to be focused rather than the one currently focused. Keep the target unresolved until the fresh state arrives (and suppress stale brightness controls), or omit the explicit monitor so the command resolves current focus.
  readonly property string targetDisplayName: selectedMonitor || focusedMonitor

  function targetMonitor() {
    return root.targetDisplayName

The panel cleared its selection on open but not the focused display it had
recorded, and the read that refreshes both is asynchronous. So for the moment
between opening and that read landing, the display the controls acted on was
whichever had focus the last time the panel was open. Moving to another display
in between was enough to make brightness or scale land on the wrong one.

Clear both. An empty target now means the answer has not arrived rather than
naming a display by default, and the two actions refuse it: an empty `--monitor`
is Hyprland's catch-all, so acting anyway would reach every display at once.
Copilot AI review requested due to automatic review settings August 11, 2026 17:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 23 changed files in this pull request and generated no new comments.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants