Skip to content

Instantly share code, notes, and snippets.

@peppidesu
Created February 8, 2024 01:27
Show Gist options
  • Save peppidesu/6db6de2813699ca29634d7dddc3a288e to your computer and use it in GitHub Desktop.
Save peppidesu/6db6de2813699ca29634d7dddc3a288e to your computer and use it in GitHub Desktop.
hyprland powersaving script
#!/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