Skip to content

Fall back to DDC/CI for brightness on external monitors#4841

Closed
justinontheporch wants to merge 3 commits intobasecamp:devfrom
justinontheporch:ddcci-brightness-fallback
Closed

Fall back to DDC/CI for brightness on external monitors#4841
justinontheporch wants to merge 3 commits intobasecamp:devfrom
justinontheporch:ddcci-brightness-fallback

Conversation

@justinontheporch
Copy link
Copy Markdown

Summary

On desktops with external monitors, there are no /sys/class/backlight devices, so the brightness keys (XF86MonBrightnessUp/Down) do nothing. This adds a ddcutil fallback that controls the monitor brightness via DDC/CI when no backlight device is found.

  • When no backlight device exists and ddcutil is installed, uses DDC/CI (VCP feature 0x10) to read/write brightness
  • The existing laptop backlight path is untouched — DDC/CI is only used as a fallback

Performance optimizations (DDC/CI over I2C is inherently slow):

  • Low sleep multiplier to minimize I2C bus wait times (~0.4s vs ~3s default)
  • Cache file to skip the DDC read on rapid keypresses (~0.02s on cache hit)
  • Background writes so the OSD appears immediately
  • flock -n to drop concurrent invocations instead of queuing them up

Prerequisites for users

DDC/CI requires ddcutil, the i2c-dev kernel module, and i2c device access:

sudo pacman -S ddcutil
sudo modprobe i2c-dev
echo 'i2c-dev' | sudo tee /etc/modules-load.d/i2c-dev.conf
sudo usermod -aG i2c $USER  # then logout/login

Test plan

  • On a laptop with a built-in display: brightness keys still work via brightnessctl (no behavior change)
  • On a desktop with an external monitor (no /sys/class/backlight): brightness keys control the monitor via DDC/CI with OSD feedback
  • Rapid key repeat: OSD is responsive, no pile-up of delayed popups
  • Without ddcutil installed: falls through to brightnessctl path (existing behavior)

🤖 Generated with Claude Code

dhh and others added 3 commits February 28, 2026 18:34
On desktops with external monitors, there are no /sys/class/backlight
devices, so the brightness keys do nothing. This adds a ddcutil fallback
that controls the monitor brightness via DDC/CI (VCP feature 0x10) when
no backlight device is found.

Performance optimizations for responsiveness on key repeat:
- Low sleep multiplier to minimize I2C bus wait times
- Cache file to skip DDC reads on rapid keypresses
- Background writes so the OSD appears immediately
- flock to prevent pile-up of concurrent instances

The existing laptop backlight path is untouched — DDC/CI is only used
as a fallback when ddcutil is installed and no backlight exists.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 1, 2026 14:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a DDC/CI-based brightness control fallback for systems without /sys/class/backlight (typical desktop + external monitor setups), so brightness keys can still function when brightnessctl can’t target a backlight device.

Changes:

  • Add a ddcutil fallback path in omarchy-brightness-display to read/write VCP 0x10 brightness when no backlight device is found.
  • Introduce caching/locking/background writes to reduce perceived latency for rapid key presses.
  • Add an additional Hyprland browser keybinding (SUPER+SHIFT+RETURN).

Reviewed changes

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

File Description
config/hypr/bindings.conf Adds a new Browser binding (not directly related to brightness/DDC fallback).
bin/omarchy-brightness-display Implements DDC/CI brightness fallback with caching, locking, and async writes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread config/hypr/bindings.conf
# Application bindings
bindd = SUPER, RETURN, Terminal, exec, uwsm-app -- xdg-terminal-exec --dir="$(omarchy-cmd-terminal-cwd)"
bindd = SUPER ALT, RETURN, Tmux, exec, uwsm-app -- xdg-terminal-exec --dir="$(omarchy-cmd-terminal-cwd)" tmux new
bindd = SUPER SHIFT, RETURN, Browser, exec, omarchy-launch-browser
Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

This PR is scoped to brightness/DDC fallback, but this change adds a new Browser keybinding (SUPER+SHIFT+RETURN). If this is intentional, please update the PR description; otherwise consider moving this to a separate PR to keep the change focused.

Copilot uses AI. Check for mistakes.
@justinontheporch
Copy link
Copy Markdown
Author

Wow, I did not try to have Claude open this PR. Sorry about that.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants