diff --git a/bin/omarchy-hibernation-setup b/bin/omarchy-hibernation-setup index cb6fbc08..ea2b7773 100755 --- a/bin/omarchy-hibernation-setup +++ b/bin/omarchy-hibernation-setup @@ -59,9 +59,10 @@ echo "HOOKS+=(resume)" | sudo tee "$MKINITCPIO_CONF" >/dev/null # Configure suspend-then-hibernate echo "Configuring suspend-then-hibernate" -sudo mkdir -p /etc/systemd/logind.conf.d /etc/systemd/sleep.conf.d +sudo mkdir -p /etc/systemd/logind.conf.d /etc/systemd/sleep.conf.d /usr/lib/systemd/system-sleep sudo cp "$OMARCHY_PATH/default/systemd/lid.conf" /etc/systemd/logind.conf.d/ sudo cp "$OMARCHY_PATH/default/systemd/hibernate.conf" /etc/systemd/sleep.conf.d/ +sudo cp -p "$OMARCHY_PATH/default/systemd/system-sleep/keyboard-backlight" /usr/lib/systemd/system-sleep/ # Regenerate initramfs echo "Regenerating initramfs..." diff --git a/default/systemd/system-sleep/keyboard-backlight b/default/systemd/system-sleep/keyboard-backlight new file mode 100755 index 00000000..c6fbea1c --- /dev/null +++ b/default/systemd/system-sleep/keyboard-backlight @@ -0,0 +1,18 @@ +#!/bin/bash + +# Turn off keyboard backlight before hibernate to prevent hang on power-off. +# The ASUS keyboard controller can block S4 shutdown if LEDs are active. + +if [[ $1 == "pre" && $2 == "hibernate" ]]; then + device="" + for candidate in /sys/class/leds/*kbd_backlight*; do + if [[ -e "$candidate" ]]; then + device="$(basename "$candidate")" + break + fi + done + + if [[ -n "$device" ]]; then + brightnessctl -d "$device" set 0 >/dev/null 2>&1 + fi +fi