OK, alors je te propsoe de faire simple. Voici un script qui mettra en veille lorsque la batterie sera faible. Exécute ce script en le mettant dans les "applications au démarrage" d'Ubuntu. Pense à rendre le script exécutable après avoir créé le fichier. Pour tester, tu pourras changer le pourcentage et mettre 95% pour observer que la mise en veille fonctionnera.
#!/bin/bash
# Notifies the user if the battery is low then supsend when critical.
# Usefull script when Ubuntu fail to suspend the laptop.
# You can replace suspend with shutdown or hiberbate.
# This script is supposed to be start at login using "Startup Applications Preferences"
while [ "true" ]
do
sleep 1m
level=$(cat /sys/class/power_supply/BAT0/capacity)
status=$(cat /sys/class/power_supply/BAT0/status)
# If discharging
if [ "${status}" = "Discharging" ]; then
# Percentage at which to suspend
action_percentage=6
if [ "${level}" -le ${action_percentage} ]; then
notify-send "Batterie trop faible, mise en veille dans 5 secondes..."
sleep 5
systemctl suspend
fi
fi
done
exit 0