Fix brightness indicator glitches caused by hardware-side key auto-repeat (#5760)
* Avoid overlapping brightness change key events. * Clarify the fix comment
This commit is contained in:
@@ -6,6 +6,21 @@
|
|||||||
|
|
||||||
step="${1:-+5%}"
|
step="${1:-+5%}"
|
||||||
|
|
||||||
|
if [[ $step == "off" ]]; then
|
||||||
|
hyprctl dispatch dpms off >/dev/null 2>&1
|
||||||
|
exit 0
|
||||||
|
elif [[ $step == "on" ]]; then
|
||||||
|
hyprctl dispatch dpms on >/dev/null 2>&1
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
runtime_dir="${XDG_RUNTIME_DIR:-/tmp}"
|
||||||
|
|
||||||
|
# Drop overlapping brightness key events so concurrent invocations do not race.
|
||||||
|
# Hardware key repeat present on some devices can otherwise glitch SwayOSD rendering.
|
||||||
|
exec 9>"$runtime_dir/omarchy-brightness-display.lock"
|
||||||
|
flock -n 9 || exit 0
|
||||||
|
|
||||||
# Start with the first possible output, then refine to the most likely given an order heuristic.
|
# Start with the first possible output, then refine to the most likely given an order heuristic.
|
||||||
device="$(ls -1 /sys/class/backlight 2>/dev/null | head -n1)"
|
device="$(ls -1 /sys/class/backlight 2>/dev/null | head -n1)"
|
||||||
for candidate in amdgpu_bl* intel_backlight acpi_video*; do
|
for candidate in amdgpu_bl* intel_backlight acpi_video*; do
|
||||||
@@ -15,14 +30,6 @@ for candidate in amdgpu_bl* intel_backlight acpi_video*; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ $step == "off" ]]; then
|
|
||||||
hyprctl dispatch dpms off >/dev/null 2>&1
|
|
||||||
exit 0
|
|
||||||
elif [[ $step == "on" ]]; then
|
|
||||||
hyprctl dispatch dpms on >/dev/null 2>&1
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if omarchy-hyprland-monitor-focused-apple; then
|
if omarchy-hyprland-monitor-focused-apple; then
|
||||||
omarchy-brightness-display-apple "$step"
|
omarchy-brightness-display-apple "$step"
|
||||||
exit
|
exit
|
||||||
|
|||||||
Reference in New Issue
Block a user