Files
nvrl 8966d07d72 feat(quickshell): brightness for the external monitor over DDC/CI
Docked with the lid shut there was no brightness control at all. Brightness
now has two backends: the built-in panel's backlight while it is lit, and
otherwise the first enabled output ddcutil can reach (VCP 0x10). DDC writes
queue like backlight writes and take the written level as read; the monitor
is re-read every 30 s for changes made on its own buttons, and detection
re-runs when outputs change.

The brightness keys go through a new `brightness` IPC call, so they step
whichever screen is lit.
2026-11-03 18:04:46 +01:00

24 lines
1.3 KiB
Lua

-- Laptop multimedia keys: volume, mic, brightness, transport.
-- `locked` keeps them working over the lock screen.
-- Volume and brightness repeat when held.
local held = { locked = true, repeating = true }
-- wpctl rather than `fluxo vol`, which goes up to 150%; `-l 1` stops at 100%.
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), held)
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"), held)
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("fluxo vol mute"), held)
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("fluxo mic mute"), held)
-- Through the shell, which steps whichever screen is lit: the panel's
-- backlight, or the external monitor over DDC when docked lid-shut.
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("qs ipc call shell brightness 10"), held)
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("qs ipc call shell brightness -10"), held)
-- Transport. Requires playerctl.
local locked = { locked = true }
hl.bind("XF86AudioNext", hl.dsp.exec_cmd("playerctl next"), locked)
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), locked)
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), locked)
hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), locked)