From 7cb3363539c42a6bde189841db2e2062033b35e3 Mon Sep 17 00:00:00 2001 From: Ahurac Date: Sun, 7 Apr 2024 00:50:32 +0200 Subject: [PATCH] bin : ajout script batstat --- bin/batstat | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 bin/batstat diff --git a/bin/batstat b/bin/batstat new file mode 100755 index 0000000..09b6d5c --- /dev/null +++ b/bin/batstat @@ -0,0 +1,11 @@ +#!/usr/bin/env sh +set -e + +battery_capacity=$(cat "/sys/class/power_supply/${1}/capacity") + +if [ "$battery_capacity" -lt 25 ]; then echo critical +elif [ "$battery_capacity" -lt 50 ]; then echo low +elif [ "$battery_capacity" -lt 75 ]; then echo medium +elif [ "$battery_capacity" -lt 100 ]; then echo high +else echo full +fi