Repository navigation
Conversation
hyprsunset's gamma filter extends the brightness range below the 1% backlight floor, but it applies to every output. Only use it while the laptop panel is the sole active display, record the user's gamma as the baseline, and hand it back when the range is left.
[Medium impact] The change affects the laptop display-brightness workflow and its shell key handler. The PR still needs the external-display reset fixed before merging. Findings
SummaryExtends laptop brightness keys below the 1% backlight floor using
|
| if (( delta < 0 )) && (( current <= 1 )); then | ||
| if gamma_dim_allowed; then |
There was a problem hiding this comment.
The external-display check only runs when lowering brightness at the backlight floor. If a user dims the laptop and then connects an external monitor, nothing restores the saved gamma, so the external screen is dimmed too. Pressing brightness up on the laptop skips this check and keeps the external screen dimmed while gamma climbs back toward the baseline.
Restore owned gamma when an external output becomes active, and check that condition before either gamma-step direction.
Knowledge Base Used: Hyprland configuration and display control
There was a problem hiding this comment.
Tested on a Dell XPS 9320 (dev channel, laptop screen only), with the commit on top of current quattro. hyprsunset wasn't running beforehand.
Once I fixed the bug below, it works well: below 1% the keys keep dimming, the OSD shows the dim level, and brightness up lifts the dim first, then the backlight goes up from 1%.
The bug: the first time the script starts hyprsunset, hyprsunset inherits the lock fd and keeps omarchy-brightness-display.lock held for as long as it runs. After that, every press exits at flock -n and the keys stop working in both directions. I got stuck at 1% with gamma at 95. fuser showed hyprsunset holding the lock. The tests pass either way, so they don't catch it.
Closing the fd in the child fixed it for me:
- setsid uwsm-app -- hyprsunset >/dev/null 2>&1 &
+ setsid uwsm-app -- hyprsunset {lock_fd}>&- >/dev/null 2>&1 &With that, going down from 1% gave gamma 95 → 90 → 85, and going up went back to 100 and then the backlight rose to 2%. The lock stayed free between presses.
There was a problem hiding this comment.
You’re right—this is a real lock-lifetime bug. The background uwsm-app/hyprsunset process inherits lock_fd, so it keeps the flock held after the brightness script exits and causes later key presses to be dropped. Closing the descriptor on the launch command is the right fix:
setsid uwsm-app -- hyprsunset {lock_fd}>&- >/dev/null 2>&1 &Thanks for catching and reproducing it; the existing tests don’t cover descriptor inheritance by the long-lived child.
Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.
What this does
Extends the brightness keys below the internal panel's 1% backlight floor with hyprsunset's gamma filter, so a laptop that stays bright at its hardware minimum can dim further (down to 30% gamma). Brightness up retraces the gamma range before the backlight rises.
This follows the suggestion in #11819 and the prototype in https://gist.github.com/minholi/31a52abaae19dc288dfb81bf4f6fb149.
Design notes
BrightnessKeys.qmlhandles internal panels in process; it now returns to the script at 1% so the gamma range is reachable.omarchy-i18n.Screenshots
The OSD while an internal panel is below its backlight floor:
Tests
test/shell.d/brightness-display-test.sh— gamma steps, the 30% floor, the external-display gate, baseline restoration, a user's gamma left alone, start on demand, and the OSD.test/shell.d/brightness-keys-test.sh— the floor handoff.test/shell.d/brightness-display-apple-cache-test.shandtest/shell.d/i18n-test.shstill pass.Tested on a VAIO/Positivo AMD Barceló laptop (
amdgpu_bl1) with Hyprland 0.56.2 and hyprsunset 0.4.0: backlight fixed at 1%, gamma 80 -> 75 -> 80, state cleared, and the user's 80 kept.Related
#13261 also used gamma below 1%, but it removes the 1% floor and dims external monitors; it now conflicts with
quattro. This takes the internal-panel case while keeping the floor and avoiding that side effect. #13332 is the DDC-less external-monitor case and is complementary.