mirror of
https://github.com/deltathetawastaken/dotfiles.git
synced 2025-12-06 15:26:36 +03:00
32 lines
608 B
Bash
Executable file
32 lines
608 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
old_brightness_file="/tmp/old_brightness"
|
|
|
|
lower_brightness() {
|
|
brightnessctl get > "$old_brightness_file"
|
|
brightnessctl set 10% # Adjust percentage as desired
|
|
}
|
|
|
|
restore_brightness() {
|
|
echo "Restoring brightness..."
|
|
if [[ -f "$old_brightness_file" ]]; then
|
|
old_brightness=$(cat "$old_brightness_file")
|
|
brightnessctl set "$old_brightness"
|
|
else
|
|
echo "No old brightness level found."
|
|
fi
|
|
}
|
|
|
|
case "$1" in
|
|
"on-timeout")
|
|
lower_brightness
|
|
;;
|
|
"on-resume")
|
|
restore_brightness
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {on-timeout|on-resume}"
|
|
exit 1
|
|
;;
|
|
esac
|