BATTERY: improve battery script and configuration in .profile

vif
Olivier DOSSMANN 2021-06-25 21:45:35 +02:00
parent 3e2a72cec1
commit 7d8fc24991
2 changed files with 4 additions and 0 deletions

View File

@ -14,6 +14,9 @@ for term in kitty termite qterminal urxvt rxvt-unicode sakura gnome-terminal; do
fi fi
done done
# Pour la batterie des ordinateurs portables (~/bin/battery)
#export BATPATH="/sys/class/power_supply/BAT0"
# Permit DBUS to be launched # Permit DBUS to be launched
if [ "$0" = "/usr/sbin/lightdm-session" -a "$DESKTOP_SESSION" = "i3" ]; then if [ "$0" = "/usr/sbin/lightdm-session" -a "$DESKTOP_SESSION" = "i3" ]; then
export $(gnome-keyring-daemon -s) export $(gnome-keyring-daemon -s)

View File

@ -46,6 +46,7 @@ battery_status()
case $(uname -s) in case $(uname -s) in
"Linux") "Linux")
BATPATH=${BATPATH:-/sys/class/power_supply/BAT1} BATPATH=${BATPATH:-/sys/class/power_supply/BAT1}
[[ -h "${BATPATH}" ]] || return 0
STATUS=$BATPATH/status STATUS=$BATPATH/status
[ "$1" = `cat $STATUS` ] || [ "$1" = "" ] || return 0 [ "$1" = `cat $STATUS` ] || [ "$1" = "" ] || return 0
if [ -f "$BATPATH/energy_full" ]; then if [ -f "$BATPATH/energy_full" ]; then