From 7d8fc24991eeca97581e249022ee9748c2e889b1 Mon Sep 17 00:00:00 2001 From: Olivier DOSSMANN Date: Fri, 25 Jun 2021 21:45:35 +0200 Subject: [PATCH] BATTERY: improve battery script and configuration in .profile --- .profile | 3 +++ bin/battery | 1 + 2 files changed, 4 insertions(+) diff --git a/.profile b/.profile index c28fa2f..cbde929 100644 --- a/.profile +++ b/.profile @@ -14,6 +14,9 @@ for term in kitty termite qterminal urxvt rxvt-unicode sakura gnome-terminal; do fi done +# Pour la batterie des ordinateurs portables (~/bin/battery) +#export BATPATH="/sys/class/power_supply/BAT0" + # Permit DBUS to be launched if [ "$0" = "/usr/sbin/lightdm-session" -a "$DESKTOP_SESSION" = "i3" ]; then export $(gnome-keyring-daemon -s) diff --git a/bin/battery b/bin/battery index 4174531..060280c 100755 --- a/bin/battery +++ b/bin/battery @@ -46,6 +46,7 @@ battery_status() case $(uname -s) in "Linux") BATPATH=${BATPATH:-/sys/class/power_supply/BAT1} + [[ -h "${BATPATH}" ]] || return 0 STATUS=$BATPATH/status [ "$1" = `cat $STATUS` ] || [ "$1" = "" ] || return 0 if [ -f "$BATPATH/energy_full" ]; then