Skip to content

Fix nonfunctional brightness sliders on some DDC monitors - #9876

Open
Murderlon wants to merge 13 commits into
omacom:quattrofrom
Murderlon:fix/ddc-write-verification
Open

Murderlon wants to merge 13 commits into
omacom:quattrofrom
Murderlon:fix/ddc-write-verification

Conversation

@Murderlon

@Murderlon Murderlon commented Sep 2, 2026 •

Copy link
Copy Markdown

Fixes #8931

Upstream investigation: rockowitz/ddcutil#626

Why

Some DDC monitors ignore brightness writes while Omarchy reports success. The previous revision also required an option unavailable in ddcutil 2.2.7, which Omarchy stable still ships.

What changed

  • Write with full DDC checks and explicit verification in one process. The same command supports ddcutil 2.2.7 and 3.0.2, without version detection, hidden options, or a package upgrade.
  • Keep rejected displays readable. Preserve the latest queued slider target after an earlier failure, reject stale brightness polls, and roll back a final failure locally. Keep brightness tied to its monitor, ignore obsolete completions, and discard queued values and active drags on a monitor switch. Show the wheel OSD only after the final write succeeds.
  • Report lock contention and failed backlight or Apple retry writes as failures so the panel cannot confirm an unapplied target. Own brightness transactions in a local controller and directly tested state model. Keep drag cancellation inside the shared slider.

Why the larger diff

The extra work makes verified writes reliable all the way to the UI. The panel preserves newer input while a write runs, rolls back failures, and prevents old results from affecting another monitor. A dedicated brightness controller and regression tests keep those guarantees in one place, reducing scattered state and making future changes safer.

DDC call timeouts remain a separate follow-up.

Tradeoffs

Every external write now pays for full DDC checks and readback verification. This favors compatibility and confirmed results over the skipped-check optimization. There is no retry loop or compatibility branch.

Blast Radius

Brightness keys, the panel slider, and bar-icon scrolling share the write result. Read failures still invalidate their own cache; a rejected write leaves the readable display cache intact.

Verification

  • Command tests passed 18 checks and brightness model tests passed 125 assertions. Native Qt tests cover process exits, crashes, failed starts, debounce, and slider cancellation. A seeded comparison of 20,000 input events matched the previous behavior. Apple cache/retry tests, monitor model/state tests, command style, manifest entrypoint loading, and ./test/cli passed. Apple retry failure was exercised using a real cached HID node with a stubbed writer.
  • Tested the affected LG UltraGear over DisplayPort with installed ddcutil 2.2.7 and an extracted 3.0.2 package. Writes returned success and independent getvcp 10 reads confirmed the requested values. The installed package was unchanged.
  • Ran the checkout in the live desktop. Real writes and lock-failure rollback passed. A two-monitor simulation covered pending-write switches, and native Qt mouse tests covered drag cancellation. Inspected screen recordings and restored the packaged shell.

@Murderlon Murderlon changed the title Verify DDC brightness writes Verify DDC brightness writes to fix brightness controls on some monitors Sep 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed by Claude Opus 5 at high effort, with an independent second opinion from Codex XHigh. Tests were run on a disposable VM built from the Omarchy ISO, not on the review host. Nothing pushed to your branch — the two substantive findings are design calls that are yours and the maintainer's to make, not mine to decide by pushing.

Tests: ./test/shell.d/brightness-display-test.sh (14 passed), brightness-display-apple-cache-test.sh (3), bin-style-test.sh (2), manifest-entrypoints-test.sh (1), and ./test/cli (116 ok, exit 0). All green at 5e2338d.

The mechanism looks right for the LG. Your fallback is exactly the ddcutil --bus 9 setvcp 10 70 invocation you showed working in #8931, so the fix is well explained. I cannot confirm it — there is no LG UltraGear here and DDC/CI behaviour is specific to the panel's firmware, so this is "explained and plausible", not "verified".

1. A failed write now disables reads too, for 60 seconds (bin/omarchy-brightness-display-ddc:126). cache_unavailable writes unavailable <ts> into the bus cache, and find_bus:53 then rejects everything for that connector until it expires. I A/B'd the base helper against yours on a worker, under an identical mock where setvcp fails and getvcp succeeds:

base:  failed write exit=1 -> next read exit=0, out='50'   (2 ddcutil calls, re-detects)
PR:    failed write exit=1 -> next read exit=1, out=''     (0 ddcutil calls)
       cache: unavailable 1788438176

That empty read reaches omarchy-monitor-state:9, which turns it into an empty first line, and Panel.qml:394 then sets brightnessAvailable = false — the slider is removed from the Display panel and the brightness keys go inert for a minute. "The write failed" is a weaker claim than "this connector is unavailable", and since every external DDC monitor now writes with --verify, one spurious DDCRC_VERIFY on a perfectly healthy panel is enough to trigger it. Worth considering whether write failures deserve their own shorter, write-only negative cache rather than reusing the connector-wide one.

2. The false OSD survives on the panel's scroll-wheel path. bin/omarchy-brightness-display:86 now exits before the OSD, which fixes the false success for the brightness keys. But Panel.qml:474-481 calls showBrightnessOsd unconditionally right after setBrightness, without waiting on the process — so scrolling the bar icon still shows brightness moving on a monitor that rejected the write. That is #8931's headline symptom, still reachable. Related: because of finding 1, dragging the slider on such a monitor makes the slider vanish at the next poll rather than snap back to the real value.

3. .full-checks latches for the session on a single transient failure (:119-123). One failed fast-path write plus one successful full-checks write writes the marker, and :115-118 then never probes the fast path again for that connector and bus. There is no timestamp and no re-evaluation on success. Demonstrated on a worker with a mock that fails the fast path exactly once:

ddcutil --bus 7 --skip-ddc-checks --verify setvcp 10 40
ddcutil --bus 7 --verify setvcp 10 40
ddcutil --bus 7 --verify setvcp 10 44
ddcutil --bus 7 --verify setvcp 10 48
ddcutil --bus 7 --verify setvcp 10 52
marker file: 7

Every later write pays full DDC checks for the rest of the session.

4. Cost and retry bound both check out. A slider drag does not verify per step: Panel.qml:253 debounces at 180 ms and :241-248/:424-428 keep one write in flight with a single coalesced follow-up, and omarchy-brightness-display:77 drops overlapping key repeats with a non-blocking flock. On the healthy path this is still one ddcutil invocation per write, same as before — the added cost is the read-back inside ddcutil, which matches the 62 ms -> 78-106 ms measured in #8931. The fallback is bounded at two write attempts with no loop. The one gap is wall-clock: no ddcutil call has a timeout, and the flock is held for the whole run, so a blocked ddcutil silently swallows brightness keys for as long as it blocks. That is pre-existing, but --verify plus the full-checks retry lengthens the window.

5. The new tests do not prove "temporarily". Codex flagged this and I confirmed it by mutation on the worker: the suite still passes with rm -f "$full_checks_cache_file" removed from cache_unavailable, and it still passes with unavailable_cache_seconds raised to ten years. brightness-display-test.sh:111-119 proves the next write emits no setvcp but never ages the timestamp, so it would be green if the negative cache were permanent and if the marker were never cleared.

Codex agreed with findings 1 and 3, which I had already reached and demonstrated before it finished — its independence is not currently guaranteed, so read that as agreement rather than as confirmation. Findings 2, the wall-clock gap in 4, and the mutation-checkable claim in 5 came from it and are its own contribution.

On the linked issues: this addresses #8931 as filed. It does not touch #8523 — that one is the internal backlight, where brightnessctl -d acpi_video0 truncates a 1% target to raw 0 on max_brightness=15; this PR changes only the external DDC helper, so it should not be listed as closing it. No overlap with #9910, which persists an internal gmux_backlight level through udev and systemd-backlight and shares no file or mechanism with this. One interaction worth knowing about: #9755 drops the Display panel poll from 5s to 1s, which multiplies the DDC reads behind omarchy-monitor-state and would surface finding 1's blackout within a second instead of five.

Waiting on you for findings 1 and 3, and on the maintainer for whether the class-2 behaviour in #8931's thread — a monitor that rejects every write, so the slider disappears — is the outcome you both want.

@Murderlon
Murderlon force-pushed the fix/ddc-write-verification branch from 8117472 to d2ebc3b Compare September 3, 2026 19:05
@Murderlon

Murderlon commented Sep 3, 2026 •

Copy link
Copy Markdown
Author

Everything except the timeout is addressed in the two commits above.

Finding 1: I chose to keep the display readable. A rejected write now simply fails. On a monitor that rejects every write the slider stays visible and snaps back to the real value, and no OSD is shown. No write only negative cache, since the key lock and the single in flight write in the panel already bound repeat attempts.

Finding 3: I removed the marker entirely. Every write probes the fast path and retries with full checks, so nothing can latch. Displays that need full checks pay one extra failed attempt per write, a fraction of a second on a path that is slow either way.

Finding 2: The wheel path now shows the OSD from the exit handler only when the helper exits zero. A failed write drops any queued follow up and refreshes so the slider snaps back.

Finding 5: The tests assert that a rejected fast write is retried with full checks and that a read still succeeds afterwards. Each mutation now fails a named assertion.

Finding 4: Left out as pre existing and noted in the description.

Murderlon and others added 2 commits September 3, 2026 21:27
A rejected write now simply fails instead of marking the connector
unavailable, so a single verify failure no longer hides the brightness
slider for a minute. The full-checks marker is gone as well: every write
probes the fast path and retries with full checks, which keeps the
helper stateless at the cost of one extra attempt on displays that need
the full checks.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015EZqaWWvjgPA8FxycKiVfv
The bar icon wheel path showed the OSD before the write finished, so a
display that rejects writes still looked like it changed. The OSD now
waits for the helper to exit zero, and a failed write drops any queued
follow-up and refreshes so the slider snaps back to the real value.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015EZqaWWvjgPA8FxycKiVfv
@Murderlon
Murderlon force-pushed the fix/ddc-write-verification branch from d2ebc3b to db46f54 Compare September 3, 2026 19:27
@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed at db46f54 by Claude Opus 5 at high effort, with an independent second opinion from Codex XHigh. Everything measured below ran on a disposable VM built from the Omarchy ISO, not on the review host.

Findings 1, 2, 3 and 5 are fixed, and I checked each by running it rather than by reading it.

Finding 1 — a rejected write no longer touches the bus cache. Three consecutive rejected writes against a mock ddcutil, then a read: out=50 exit=0, cache still 7 80 <ts>, zero detect --brief calls. The connector stays readable, so the slider stays.

Finding 3 — the marker is gone and the fast path is probed every time. On a display that always needs the fallback, three writes produced exactly six setvcp invocations, alternating --skip-ddc-checks --verify and --verify. Bounded at two per write, no loop.

Finding 2 — the wheel sets brightnessOsdPending and Panel.qml:439 shows the OSD only after exit zero.

Finding 5 — the one I was most sceptical of, and it holds. Six mutations, each caught by a named assertion:

drop the full-checks fallback         -> not ok - a rejected fast DDC write is retried with full checks
re-add rm -f "$cache_file"            -> not ok - a rejected write keeps the cached DDC bus
re-add cache_unavailable              -> not ok - external brightness stays readable after a rejected write
revert the fast path to --noverify    -> not ok - the first external write verifies the fast DDC path
retry the fast command, not full      -> not ok - external brightness retries with full DDC checks
loop the fallback five times          -> not ok - a rejected write tries both DDC paths

Tests at db46f54: brightness-display-test.sh 13 passed, brightness-display-apple-cache-test.sh 3, bin-style-test.sh 2, manifest-entrypoints-test.sh 1, ./test/cli 116 ok, exit 0.

On the timeout you left out of scope, I measured what it costs so the decision is on the record. With a mock ddcutil blocking 4s per setvcp: a healthy write is one invocation holding the lock 4010 ms; a rejected write is two, holding it 8014 ms. Keypresses arriving during the block return exit 0 in 2-4 ms — dropped by the non-blocking flock, not queued — so nothing hangs and no OSD lies. The panel is unaffected because Process is asynchronous, and reads never take the lock (omarchy-brightness-display returns before line 76 when no step is given), so omarchy-monitor-state still answered in 23 ms during a blocked write. No new hang, then; but the window in which brightness keys silently do nothing roughly doubles on a display that needs the fallback or rejects every write. Reasonable as a follow-up, now that the size of it is written down.

Three things still open, none of which I think should block.

  1. --verify can be a false negative, and the consequence is now user-visible. ddcutil's docs say verification is the default and --noverify disables it, so this is a return to stock rather than something new — but Verification failed for feature 10 rockowitz/ddcutil#323 reports Verification failed for feature 10 occurring intermittently on a healthy HP ZR24w over DisplayPort, self-correcting after retries and blamed on dynamic sleep timing. Your fallback gives one retry with full checks, which resets that timing, so it should absorb most of it. What survives both attempts exits 1, and the user then sees the brightness move with no OSD and a slider that snaps back. That is reasoning plus that report; there is no DDC monitor here and I cannot confirm it.

  2. Panel.qml:432's root.refresh() is exactly the re-read race the comment directly above it warns about. If that read comes back empty, Panel.qml:395 sets brightnessAvailable = false and the slider disappears until the next 5s poll. The base never did this, because a failed write refreshed nothing. Small window and self-correcting, but it is "Brightness slider hidden when DDC fails but ACPI backlight available" #10120's symptom arriving by a different door.

  3. Codex found, and I confirmed by running Quickshell 0.3.1 on a worker, that exited is not emitted when a process fails to start — only runningChanged, and running never even goes true:

WARN: Process failed to start, likely because the binary could not be found.
qml: MISSING runningChanged running=false
qml: BAD exited code=3 status=0

So brightnessOsdPending is never cleared on that path, and the next successful write shows one OSD it did not earn. brightnessSetQueued is fine: Panel.qml:242 only sets it while running is true and :247 clears it on the next call. Only reachable with omarchy-brightness-display off PATH, so I would leave it.

Codex also observed that the new QML behaviour has no test — deleting the success-OSD block or the failure refresh leaves the whole suite green. That is true, and it is the one place the suite is now weaker than the helper it covers. I rejected one of its claims: it said a second input during a failed start can strand brightnessSetQueued, which :242/:247 rule out.

On #10120, which was filed after your push: orthogonal at this head, and worth saying explicitly because it was not orthogonal at 5e2338d. #10120 is the read path — omarchy-brightness-display:42-53 treats every non-internal connector as DDC and exits after that attempt without reaching the ACPI fallback at :55, which you do not touch. At 5e2338d, though, a rejected write poisoned the bus cache for 60s, which would have produced #10120's exact symptom on any display that reads fine but rejects writes; these two commits remove that. A laptop panel with no external display is unaffected either way, since use_ddc_display is false and none of this code runs.

Also cleared from last time: the question about a monitor that rejects every write is largely answered — the slider stays and snaps back rather than vanishing.

Nothing is waiting on you. This is with the maintainer now.

Codex reviewed at xhigh. It reached the fixes for findings 1 and 3 alongside conclusions I had already demonstrated, so read that as agreement rather than confirmation — its sandbox restricts writes, not reads, so its independence is not currently guaranteed. The false-negative reasoning above, the Quickshell start-failure mechanism, and the missing QML test coverage are its own contributions, and I verified each before repeating it.

Refreshing on a rejected write re-reads brightness, and an empty read
clears brightnessAvailable and hides the slider until the next poll --
the race the comment above the handler already warns about. Track the
percentage the hardware last confirmed and revert to that instead.

Letting a write in flight own brightnessPercent, rather than having the
5s poll overwrite it mid-write, makes it the value the hardware still
owes us. That retires pendingBrightnessPercent and brightnessSetQueued.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TbAGLrXMLvUZXmJxaRh1K7
@Murderlon

Copy link
Copy Markdown
Author

A rejected write made the panel read its state again. An empty read clears brightnessAvailable and hides the slider until the next poll. The panel now keeps the last percentage that the hardware confirmed. A rejected write puts the slider back to that percentage and does not read the state again.

A write in flight now owns brightnessPercent. The 5-second poll does not change that value during a write. Therefore pendingBrightnessPercent and brightnessSetQueued are not necessary. The panel has four brightness properties, not six.

test/shell.d/brightness-panel-test.sh is new. It has four assertions for the behaviour of the three commits: the OSD comes only after a verified write, and a rejected write puts the slider back without a new read.

Hardware test

I ran the commands from this branch on the affected display (LG UltraGear 27GM950B-B, DisplayPort). After each command I read the actual value with ddcutil getvcp 10.

command exit hardware
60% 0 80 -> 60
+5% 0 60 -> 65
5%- 0 65 -> 60
35% 0 60 -> 35
50% (with the OSD) 0 35 -> 50

I did not run the QML in a live shell, because this desktop uses the packaged shell. The helper is verified on the hardware. The panel behaviour is covered by the tests only.

Upstream status (rockowitz/ddcutil#626)

The maintainer replied on 7 September. He added the option --max-setvcp-and-verify-tries to branch 2.2.8-dev. It replaces the hidden option --i5.

We cannot use the new option now. Arch Linux supplies ddcutil 2.2.7, and 2.2.7 stops with Unknown option --max-setvcp-and-verify-tries. ddcutil 2.2.8 is not released. Therefore this PR keeps the retry with the full DDC checks, which is correct on 2.2.7 and on 2.2.8.

@Murderlon

Murderlon commented Sep 15, 2026 •

Copy link
Copy Markdown
Author

Great news! The upstream issue paid off and ddcutil 3.0.1 is now released and packaged in Arch Extra, so this PR now uses the public --max-setvcp-and-verify-tries 2 replacement for --i5 2. The two-process full-checks fallback is removed, verification and its one retry now share the same display handle.

Note: this does expect the new version to be present for this to work. Currently ddcutil is unpinned, we can optionally pin ddcutil>=3.0.1

@Murderlon Murderlon changed the title Verify DDC brightness writes to fix brightness controls on some monitors Fix nonfunctional brightness sliders on some DDC monitors Sep 15, 2026
@omarchybot omarchybot added bug Something isn't working compatibility Make Omarchy work better on everything! labels Sep 27, 2026
@seantimm

Copy link
Copy Markdown

Confirming this on a second monitor and GPU, with the root cause, and some latency numbers for the approach in this PR.

Setup: Dell Alienware AW3926QW on DP-3, NVIDIA RTX 5070 Ti (driver 610.57, /dev/i2c-5), Omarchy 4.0.4-1, ddcutil 2.2.7 (also tested 3.0.2). Same symptom as the LG here: the OSD alternates between e.g. 70 and 80 on successive presses while the monitor stays at 75, and the panel slider does nothing. The monitor's own menu and Windows work.

Root cause (details and a raw i2c reproduction in rockowitz/ddcutil#626): every ddcutil process probes slave address 0x37 by writing a single 0x00 byte. This monitor treats that as a malformed DDC/CI frame and discards the next message. A read gets a null response and ddcutil silently retries; a Set VCP is dropped. That is why a read on the same handle before the write "primes" the display: it is the sacrificial message. It is not NVIDIA-specific (the LG in #626 is on amdgpu), and ddcutil 3.0.2 still sends the probe on the --bus path.

What the PR's ddcutil invocation costs here (3.0.2, stock settings, fresh process per call, monitor value read back over raw i2c afterwards):

Invocation Monitor changed Time per keypress
current script: --skip-ddc-checks --noverify never ~200 ms
--skip-ddc-checks --verify --max-setvcp-and-verify-tries 2 (this PR) 5/5 390–840 ms
full checks --verify yes ~500 ms

So the PR makes the write correct on this hardware, which is the important part, but a keypress becomes 0.4–0.8 s and a held key advances at 1–2 steps per second (the script's flock -n drops presses that arrive while one is running). Each I2C transaction on the NVIDIA adapter is ~25 ms and ddcutil spends three of them (EDID read + probe) before the real exchange, then a read, a second write and another read.

For comparison, the same script with a local shim that answers its two ddcutil calls directly over i2c-dev (no probe, no EDID read, no sleeps) is ~65 ms per keypress including the OSD and ~18 steps/s on a held key, all writes landing. Not proposing that for Omarchy, just to show where the floor is once the probe is out of the way.

Suggestions, in case they help the design:

  • Merge the correctness fix, but treat the latency as a ddcutil problem to push upstream (skipping the probe when --bus --skip-ddc-checks are given would make the current fast --noverify path correct on these monitors, ~200 ms here).
  • Show the OSD before the write with the target value and only correct it if verification fails, rather than waiting for verification. On slow adapters the difference between 30 ms and 500 ms to first feedback is the whole feel of the key.
  • Cache the last confirmed value for a couple of seconds so a held key does one write per step instead of a read and a write (Step the internal backlight in the shell instead of a script per keypress #13427 did the equivalent for the internal backlight).
  • Fall back to hyprsunset gamma on displays without DDC/CI #13332 classifies a display as "without DDC/CI" when this helper exits nonzero. On monitors like these, that would flip a working DDC monitor to gamma control after the first failed verify, so that PR probably wants to distinguish "no DDC" from "write not accepted".

Happy to test revisions on this hardware.

@seantimm

seantimm commented Oct 1, 2026

Copy link
Copy Markdown

Update from the ddcutil side, since it changes the picture for this PR.

The root cause is fixed upstream. In rockowitz/ddcutil#626 the maintainer changed the slave-address probe (it is now a one byte read with a zero length write fallback, instead of the one byte write these monitors choke on) and made --skip-ddc-checks skip the probe altogether. That is on the 3.0.3-dev branch, not yet released. I built it and tested on the Dell AW3926QW / NVIDIA setup from my earlier comment, reading the monitor's value back over raw i2c after every write:

ddcutil --bus N --skip-ddc-checks ... setvcp 10 V on 3.0.3-dev Writes landed Time
--noverify (what the script does on master) 5/5 (0/6 on 2.2.7 and 3.0.2) ~143 ms
--noverify --lazy-sleep 5/5 ~94 ms
--verify --max-setvcp-and-verify-tries 2 (this PR) 5/5, verification passes on the first try ~189 ms
same + --lazy-sleep 5/5 ~190 ms

For comparison, this PR's invocation took 390–840 ms here on 3.0.2, because the first write was always lost and the retry was always needed.

What that means for the PR, as I see it:

  • On ddcutil 3.0.1 and 3.0.2 the verified retry in this PR is still the only thing that makes these monitors work, so the PR remains the right fix for any Omarchy release that ships those versions.
  • Once 3.0.3 is the floor, the unverified write on master is correct again for these monitors. Verification then becomes a safety net rather than a requirement, at a cost of ~45 ms per write on a slow adapter (more on a keypress, since the script also does a read first).

One small, independent win: --lazy-sleep. ddcutil sleeps ~50 ms after a Set VCP so that the next command is safe. The script's process exits immediately after the write, so that sleep protects nothing. Adding --lazy-sleep to the --noverify write took it from ~148 ms to ~92–94 ms here, with every write landing, including ten back to back. The option already exists in 2.2.7 and 3.0.x. It makes no difference on the --verify path, where the sleep is needed before the read-back.

Happy to re-test any revision on this hardware.

@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed at f1617fa by Claude Opus 5.5, with a second opinion from Codex at medium effort. The tests ran on a disposable VM built from the current Omarchy ISO, not on the review host. Nothing was pushed to your branch.

Blocking: on the ddcutil that Omarchy ships today, every external brightness write fails. The current ISO installs ddcutil 2.2.7-1. The package databases of the Omarchy mirrors list 2.2.7-1 on stable-mirror and rc-mirror. Only mirror.omarchy.org (edge) has 3.0.2-1. I ran the exact invocation from bin/omarchy-brightness-display-ddc:163 against the real 2.2.7 binary on the worker:

$ ddcutil --bus 7 --skip-ddc-checks --verify --max-setvcp-and-verify-tries 2 setvcp 10 50
   Unknown option --max-setvcp-and-verify-tries
exit 1

ddcutil rejects the arguments before it opens any bus, so this does not depend on the monitor. The helper hides stderr and exits 1, and bin/omarchy-brightness-display:86 then exits before the OSD. On stable and RC, brightness keys stop working on every DDC monitor, including the ones that work today, and the panel slider snaps back on every move. The migration that installs ddcutil (migrations/1785608251.sh) has no version requirement, so a ddcutil pin would not help until the stable mirror carries 3.x. A pin also does not upgrade an installed 2.2.7. The test mock accepts the new option, so the suite cannot catch this.

These are the options as I see them. The choice is yours or the maintainer's:

  • Check whether the installed ddcutil supports the option, and fall back when it does not. On 2.2.7, --noverify keeps today's behaviour, which is still broken on the affected monitors. The hidden --i5 2, which you tested on 2.2.7, is the only fallback that fixes these monitors on 2.2.7.
  • Hold this PR until the stable mirror carries ddcutil 3.x. Then pin ddcutil>=3.0.0 and add a migration that upgrades installed copies.

Smaller findings in Panel.qml. I confirmed each one by reading the code:

  1. :443-447: a failed write drops a newer value that is waiting to be sent. Take a confirmed value of 40. A drag sends 50, and the user releases at 70 while 50 is in flight. If 50 fails, the slider snaps to 40 and 70 is never sent. The base sent the queued value whether the earlier write failed or not. To fix it, revert only when the failed value is still the latest one, and otherwise send the newer value.
  2. :403: confirmedBrightnessPercent takes the poll's value even while a write is in flight, but :407 guards brightnessPercent. A poll that read the hardware before the last successful write can then roll the confirmed value back. A later failed write snaps the slider to a value the hardware no longer has. The window is narrow.
  3. bin/omarchy-brightness-display:77 exits 0 when another brightness command holds the lock and this request is dropped. The panel now treats exit 0 as a verified write. A wheel step that collides with a key press records a confirmed value that was never written, and shows an OSD for it. The lock behaviour is older than this PR, but this PR is the first to rely on exit 0 meaning written.

The panel test checks the source text, not the behaviour. On the worker, I changed if (exitCode !== 0) to if (false), which disables the failure branch completely. brightness-panel-test.sh still passed all four assertions. It does catch three other mutations: removing the snap-back, adding a refresh() to the failure path, and showing the OSD from the wheel again.

Tests at f1617fa, with the shell linked to the branch on the worker: brightness-display-test.sh 13 passed, brightness-panel-test.sh 4, brightness-display-apple-cache-test.sh 3, bin-style-test.sh 2, manifest-entrypoints-test.sh 1, and ./test/cli exit 0. The worker has no DDC monitor. The hardware results in this thread are yours and @seantimm's, on ddcutil 3.0.1 and 3.0.2, so they do not cover the 2.2.7 path described above.

From the last review: the stale refresh() after a rejected write is fixed, because the slider now snaps back locally.

Related: #13332 decides that a display has no DDC/CI when this helper exits nonzero. With this PR on ddcutil 2.2.7, every DDC monitor would exit nonzero, so the two PRs need to agree on that exit contract.

Codex found the same 2.2.7 failure from the measured facts I gave it. It agreed with me there, and its independence is not guaranteed. The three Panel.qml findings and the vacuous panel test came from Codex. I checked each one against the source before including it here, and ran the test mutation on the worker.

This is now waiting on you: the PR needs to handle ddcutil 2.2.7, or the maintainer needs to decide to hold it until the mirrors carry 3.x.

@z23

z23 commented Oct 16, 2026

Copy link
Copy Markdown

Another affected model: Dell Alienware AW3926QW (39" 5k2k) over USB-C.

  • Omarchy edge: omarchy-dev 4.0.0.r7026.g51bfd1d-1 (fully updated; bin/omarchy-brightness-display-ddc on quattro still has the same setvcp line)
  • ddcutil 3.0.2, Hyprland 0.56.2, kernel 7.2.8
  • Intel + NVIDIA laptop; the monitor is driven by the NVIDIA GPU (card1-DP-1, driver nvidia)

Same symptom as #14648 / #8931: --skip-ddc-checks --noverify setvcp 10 exits 0 but the monitor ignores it every time, even immediately after a successful getvcp.

Tested the ddcutil invocations directly on hardware (not the PR branches themselves):

Write Result Time per write
--skip-ddc-checks --noverify setvcp (current) never applied —
--noverify setvcp (#14691's approach) applies ~0.8s
--skip-ddc-checks --max-setvcp-and-verify-tries 2 setvcp (this PR's approach) 5/5 applied 0.48–0.76s

So this PR's approach works on the AW3926QW and is faster than dropping the flag.

@omarchybot

Copy link
Copy Markdown
Collaborator

Looked again at f1617fa because of two changes since the last review: the new hardware report above, and #14691, which fixes the same bug a different way. The branch has not moved, so the earlier test results still apply and nothing was re-run except the check below. Nothing was pushed.

The ddcutil 2.2.7 problem is still there. I checked the Omarchy mirrors on a disposable VM today. stable-mirror and rc-mirror still carry ddcutil 2.2.7-1. Only the edge mirror carries 3.0.2-1, and edge is what @z23, @seantimm and the earlier hardware results all used. On 2.2.7 this branch's write exits with Unknown option --max-setvcp-and-verify-tries, so every external brightness write would fail on stable and RC.

Competing fix: #14691. It drops --skip-ddc-checks from the setvcp write only and keeps --noverify. That needs no new ddcutil option. The #14648 reporter confirmed it on an HP Z27 with ddcutil 2.2.7, and @z23's table above shows it working on the AW3926QW with 3.0.2 (about 0.8 s per write, against 0.48–0.76 s here). Normally the older pull request wins. It does not here, because this one breaks brightness on the ddcutil that stable and RC ship and #14691 does not. So I recommend #14691 to the maintainer as the fix to land now, and this pull request gets no ready.

The parts of this branch that #14691 does not have are still worth having once stable carries ddcutil 3.x and verification can rely on it:

  • a verified write
  • the Panel.qml change that shows the OSD only after a successful write and snaps the slider back after a rejected one

Those would make a good follow-up then. Whether to hold this pull request for that, or rework it on top of #14691, is the maintainer's call.

Second opinion: Codex at medium effort, given both diffs and the mirror facts and asked which should win. It also chose #14691, for the same 2.2.7 reason. That is agreement, and its independence is not guaranteed. It could not fetch #14691's diff itself, so I checked that diff against the description it was given.

Waiting on the maintainer.

@greptile-apps

greptile-apps Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge; no new actionable issues were found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

This PR uses full DDC checks and readback verification, reports failed writes, and keeps brightness changes tied to their monitor.

  • Brightness writes report success only when the write succeeds.
  • The monitor panel keeps brightness changes with the display they target.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[User changes brightness] --> B[Controller starts write]
  B --> C{Write succeeds?}
  C -->|Yes| D[Update original monitor's cached level]
  D --> E[Keep verified level over overlapping poll]
  C -->|No| F[Keep newer input or restore confirmed level]
Loading

Reviews (6) · Last reviewed commit: "Record each verified brightness write fo..." · Reviewed by Greptile

Comment thread bin/omarchy-brightness-display-ddc Resolved
Comment thread shell/plugins/panels/monitor/Panel.qml Resolved
Comment thread shell/plugins/panels/monitor/Panel.qml Resolved
@omarchybot

Copy link
Copy Markdown
Collaborator

Looked at d0158f3 because the branch moved. This was not a full review: Claude Opus 5.5 read the new diff, but no second opinion ran. The configured reviewer (Codex Medium) answers, but this machine has used up its review allowance for today. Classifying the change and choosing between competing fixes both need that second opinion, so the classification is unsettled for now. No tests were run and nothing was pushed.

The blocker from the last review is gone, going by the diff. The external write in bin/omarchy-brightness-display-ddc:163 is now ddcutil --bus N --verify setvcp 10 V. It no longer uses --max-setvcp-and-verify-tries, which ddcutil 2.2.7 rejects, and it no longer passes --skip-ddc-checks on the write. --verify is a standard ddcutil option in 2.x, and you report testing this exact command on the LG with 2.2.7 and 3.0.2. I could not check 2.2.7 myself: today's ISO worker ships ddcutil 3.0.2.

#14691 is open again. The last comment recommended #14691 over this pull request only because this one broke brightness on ddcutil 2.2.7. That reason no longer applies. Both now write with full DDC checks. #14691 keeps --noverify and changes nothing else. This pull request verifies the write and also changes Panel.qml. Which one should land will be decided on the next full review, with a second opinion.

Nothing is waiting on you. This item comes round again when a second opinion can run.

@omarchybot omarchybot removed bug Something isn't working compatibility Make Omarchy work better on everything! labels Oct 17, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Looked at a98eb81 because the branch moved again. This was not a full review either. Claude Opus 5.5 read the new commit, but no second opinion ran. The configured reviewer (Codex Medium) answers, but this machine has used up its review allowance for today. The classification still needs that second opinion, so it stays unsettled and the class labels stay off. No tests were run and nothing was pushed.

What the new commit does, going by the diff: it moves the panel's brightness bookkeeping out of Panel.qml into BrightnessController.qml and a plain-JS state model in BrightnessModel.js. The behaviour from earlier rounds stays: a failed write that has a newer target queued sends that target instead of snapping back, a poll that started before a write cannot overwrite it, a monitor switch makes the old write's completion a no-op, and the wheel OSD shows only after the final write succeeds. I found nothing wrong in it from reading alone. That is one model's reading, not a verified result.

The full review on a worker, and the choice between this and #14691, come on the next pass that has a second opinion. Nothing is waiting on you.

@john-griffin

Copy link
Copy Markdown

Note

🤖 Claude Opus 5.5 responding on behalf of john-griffin

Another monitor with the same symptom, the AOC AGP277KXM over DisplayPort (amdgpu, ddcutil 3.0.2, Omarchy 4.5.0), plus a trace that I think explains the cause.

With --trace I2C, the monitor answers the first DDC request after ddcutil opens the bus with a null message (6e 80 be). Every new process hits this. A full-checks run absorbs it, because its probe getvcp 10 gets the null reply and is retried. A getvcp with --skip-ddc-checks also retries, which is why reads work. A setvcp with --skip-ddc-checks sends the write as that first request, and a write has no reply to retry on, so the monitor drops it. That matches the --i5 2 result in rockowitz/ddcutil#626: the write lands once a second attempt runs in the same process.

Sending the same pair twice in one call keeps the fast path and lands every time on this monitor:

ddcutil --bus "$bus" --skip-ddc-checks --noverify setvcp 10 "$raw_target" 10 "$raw_target"
helper +5% key step absolute % (slider) applied
quattro 0.54 s — no
#9876 1.4–1.6 s — yes
double pair 0.47–0.66 s 0.23 s yes

ddcutil 2.2.7 already loops over multiple setvcp pairs, so no version check is needed. A monitor that accepts the first write pays one extra post-write sleep (about 50 ms). This doesn't help a monitor that rejects every write, like the ProArt in #8931, so the verify-and-roll-back work in #9876 still applies there. It could sit on top of the double write instead of the full-checks retry. I haven't tested this on the LG or the HP Z27.

The monitor panel now shows one display at a time from per-display brightness levels. The brightness controller follows the shown display (the focused one unless the picker shows another) and takes its level from those polls; the bar wheel and IPC write to the same display.
Comment thread shell/plugins/panels/monitor/Panel.qml Resolved
@omarchybot omarchybot added bug Something isn't working compatibility Make Omarchy work better on everything! labels Nov 26, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed d8994f14a20e78418752919e47a4b21460867b89 against the current quattro code, the #8931 report, the previous discussion and the related brightness fixes. Codex (GPT-6, high effort) reviewed the source, with a second opinion from Opus 5.5 High and muse-wonder via pi at high thinking effort. The additional reviewers agreed on the stale-cache finding; independence is not guaranteed.

The earlier ddcutil 2.2.7 option problem is gone from the diff, and #14691 closed without merging. This pass found two remaining panel integration problems by tracing the source:

  • Panel.qml:385–388,411–419,705–707: successful writes change the controller but never update brightnessLevels; a poll rejected by the controller can still replace that cache. Setting A from 30% to 70%, picking B and returning to A before a fresh poll therefore seeds A from the cached 30%, so the next +5 step targets 35%. The existing model and controller tests do not load Panel.qml and cannot check this cache wiring. This agrees with Greptile's current stale-level finding.
  • Panel.qml:633–648: reopening starts refresh() before resetting the selected display. When that reset changes monitors, it advances the controller's revision, so acceptRead rejects the open-time poll's generation. Resetting the display before starting the read avoids that ordering problem. A monitor switch during any poll can invalidate its generation in the same way. Opus identified the open-time ordering, muse identified the wider mid-poll switch case, and I checked both against this head.

The new Apple cache and brightness model test cases also belong in the existing area test files under the base branch's AGENTS.md; most of the new Apple cache file exercises unchanged behavior. Keeping the hardware write/status fix and the larger panel changes separately reviewable would reduce the work needed to assess each.

No contributor code or tests ran in this session: our triage policy permits execution only after branch protection is confirmed, and the release branches reported protected: false. Nothing was pushed and there are no worker/UI captures or new hardware confirmation to claim. The only listed check is a completed Greptile Review, whose current summary is 4/5 with open findings. bug and compatibility are applied; verified and ready remain off. This pass waits on the maintainer because execution is blocked; the panel fixes still need correction and a worker/UI run.

A verified write now updates the shown display's cached level, and a poll that started before a write can't put the old level back, so showing a display again starts from what its hardware holds. The panel returns to the focused display before its open-time read, so the controller doesn't reject that read as stale.
The brightness model and native lifecycle tests now live in monitor-test.sh, and the Apple cache test upstream removed stays removed.
@Murderlon

Copy link
Copy Markdown
Author

Not done: a display switch during a running poll keeps the previous poll's level until the next one (≤5 s), which isn't worth a queued re-read. Happy to split the helper and panel changes if the maintainer prefers.

@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed fab9d45c2b59aa355776154bb485d8a0b5d91590, including the new commits, panel/cache wiring, tests, #8931 and the review replies. Codex (GPT-6, high effort) reviewed the source, with second opinions from Opus 5.5 High and muse-wonder via pi at high thinking effort. Both additional reviewers agreed on the two remaining cache cases below; independence is not guaranteed. These are source traces, not executed reproductions.

The open-time ordering is corrected: selectedName resets before refresh(). The simple case of completing a write on A, switching to B and returning to A is also addressed in the source. The panel tests now live in monitor-test.sh, and the extra Apple cache test file is gone.

Two cases still lose the value of a successful write:

  • Switch away before a write finishes: A is at 30%, its write to 70% starts, and the picker switches to B. When A's write succeeds, BrightnessModel.js:62–65 leaves confirmed on B, and remember at :94–99 records only the currently shown monitor. A's cache remains 30%. Returning to A before a fresh poll makes the next +5 step write 35%, although A is at 70%.
  • Switch during an older poll, then write: a poll starts while A is selected and reads B at 20%. Switch to B and successfully write 70% before that poll finishes. knownLevels at BrightnessModel.js:82–89 protects only A, the monitor captured at poll start, so the old response replaces B's saved 70% with 20%. The controller rejects the stale generation, but switching away and back adopts the cache's 20%; the next +5 writes 25%. Successful writes need to remain recorded for their own monitor, including when selection changes during the poll or write.

The new cache tests cover completion on the selected monitor and protection of the poll-start monitor; they do not cover these two sequences. The native fixture loads the controller and slider rather than the full panel wiring.

No contributor code or tests ran, and nothing was pushed. Our triage rules require confirmed release-branch protection before executing contributor code; quattro, master and dev still report unprotected. Greptile's completed review of this head is 4/5 and still flags the saved-level problem. bug and compatibility are applied; verified and ready remain off. This waits on the maintainer because execution is blocked; the remaining cache corrections and worker/UI verification are still needed.

@Murderlon

Copy link
Copy Markdown
Author

Both cases fixed in 53ea914: a verified write is now recorded for the display it was written to, and a poll that was running when it landed can't replace it. This replaces the generation-based remember/knownLevels.

@omarchybot

Copy link
Copy Markdown
Collaborator

Re-reviewed 53ea914e9e80e2bdafbe962da85828372cfd76c6, including the new delta, panel/controller wiring, model and native-fixture tests, the earlier findings and #8931. Codex (GPT-6, high effort) reviewed the source, with second opinions from Opus 5.5 High and muse-wonder via pi, thinking high. Both additional reviewers agree the two previous cache cases are addressed; independence is not guaranteed. These are source traces, not executed reproductions.

Successful writes are now saved for their original monitor, and the poll merges every write completed while it was running over its older readings.

One related sequence still leaves the controller behind the cache: start A at 30%, request 70%, then select B and return to A before the write finishes. Returning creates a new A epoch using the cached 30%. When the old A write succeeds, BrightnessModel.js:62–71 keeps the shown value at 30%, while Panel.qml:714–719 records 70% only in the caches. Nothing synchronizes that verified value back into the currently shown controller. A +5 step before a fresh poll therefore requests 35% although the hardware is at 70%. Synchronizing the current monitor after written, while preserving newer pending input and suppressing an obsolete OSD, would address that variant. The new tests check the returned value and signal but do not load this Panel wiring.

Opus 5.5 High agrees with this remaining source trace. muse-wonder via pi at high thinking effort treats the A → B → A behavior as intended epoch conservatism. I am retaining the finding because the stale value determines the next hardware write, rather than only delaying the slider display.

No contributor code or tests ran, no worker/UI captures were taken, and nothing was pushed. Our triage rules require confirmed branch protection before execution; quattro, master and dev still report unprotected. Greptile has completed its review of this head at 5/5. bug and compatibility are applied; verified and ready remain off. This waits on the maintainer because execution is blocked; the remaining sequence and a worker/UI run still need resolution.

@omarchybot

Copy link
Copy Markdown
Collaborator

I checked the new handoff from #20297 against 53ea914e9e80e2bdafbe962da85828372cfd76c6, including both diffs, the brightness controller and model, and the shared audio-slider callers. Codex High reviewed the source, with second opinions from Opus 5.5 High and muse-wonder via pi, thinking high. Their agreement is not guaranteed to be independent. This was a source comparison; no tests ran.

Aditya Kumar's equal-value move guard is a small integration candidate: PanelSlider.qml:147–152 currently emits moved even when the rounded value stays the same. After an earlier write has completed, that event can queue another verified DDC write of the same value through BrightnessController.preview(). The model's finish-time deduplication covers an active write, rather than one already completed. Opus treats this as a low-severity defect; muse treats it as optional churn. Both accept the guard as proportionate. Immediate writes throughout a drag and the direct internal-backlight route are separate behavior and performance choices; the handed-over Panel writer also targets different state code and cannot be copied over this controller unchanged.

No changes were pushed, and the #20297 handoff remains pending. The earlier findings at this head are unchanged. Our triage rules require confirmed branch protection before executing contributor code; quattro, master and dev still report unprotected. That prevents the worker regression, suite and UI checks needed before pushing an adaptation. Greptile's completed review of this head is 5/5, but there is still no qualifying worker or hardware evidence at this head. This remains with the maintainer; verified and ready stay off.

@emirb

emirb commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Hi @Murderlon thanks so much for this. I tested ddcutil 3.0.3-dev with the probe fix from rockowitz/ddcutil#626 on an LG UltraGear+ with DP-1 and unmodified quattro lands 5/5 writes cleanly (~66 ms even with --skip-ddc-checks --verify, vs. ~1.1 s on 3.0.2 with full checks).

Rather than merging the slower 3.0.2 workaround here, we're going to wait for ddcutil 3.0.3 to land hopefully super soon and revisit any remaining verification/panel improvements cleanly on top of it. I'll keep this PR open.

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

Labels

bug Something isn't working compatibility Make Omarchy work better on everything!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Display panel brightness slider does not work with LG UltraGear evo 27GM950B-B

6 participants