Created
February 8, 2024 01:27
-
-
Save peppidesu/6db6de2813699ca29634d7dddc3a288e to your computer and use it in GitHub Desktop.
hyprland powersaving script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | |
last="" | |
while :; do | |
current="$(cat /sys/class/power_supply/BAT0/status)" | |
if [ "$current" != "$last" ]; then | |
last="$current" | |
else | |
sleep 1 | |
continue | |
fi | |
if [ "$last" = "Discharging" ]; then | |
hyprctl keyword source $dir/powersave.conf | |
else | |
hyprctl reload | |
fi | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment