hypr: use a single brightnessctl call for the brightness OSD

brightnessctl -m s sets and prints the new percentage in one invocation,
so drop the second brightnessctl call per (repeating) brightness keypress.
This commit is contained in:
2026-06-01 14:05:35 +02:00
parent 1d85012b53
commit 119789cc53
@@ -377,9 +377,10 @@ hl.bind("XF86AudioPrev", hl.dsp.exec_cmd("playerctl previous"), { locked = tr
-- Brightness — let brightnessctl do the math, then push the new percentage to
-- the Quickshell OSD (field 4 of `-m` output is the percentage, e.g. "70%").
local function brightness_step(arg)
-- Single brightnessctl call: `-m s` sets and prints the machine line
-- (device,class,current,percent,max); field 4 is the new percentage.
return hl.dsp.exec_cmd(
"brightnessctl -e4 -n2 s " .. arg ..
" >/dev/null && qs ipc call osd brightness \"$(brightnessctl -m | cut -d, -f4 | tr -d %)\""
"qs ipc call osd brightness \"$(brightnessctl -e4 -n2 -m s " .. arg .. " | cut -d, -f4 | tr -d %)\""
)
end
hl.bind("XF86MonBrightnessUp", brightness_step("1%+"), { locked = true, repeating = true, description = "Brightness up (1%)" })