From 0cb7943aaa4f921e8b0442d35a0c409e862623f2 Mon Sep 17 00:00:00 2001 From: Anton Bobov Date: Fri, 24 Mar 2017 22:34:25 +0500 Subject: Add scripts. * auto-display - toggle all displays in auto mode * bang - play audio file (useful to notify on other process ending) * bat - display battery status * through-vpn - add host to route through vpn --- bat | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 bat (limited to 'bat') diff --git a/bat b/bat new file mode 100755 index 0000000..071bb20 --- /dev/null +++ b/bat @@ -0,0 +1,16 @@ +#!/bin/bash + +ac_online=$(cat /sys/class/power_supply/AC/online) + +if [ "x$ac_online" = "x1" ] ; then + echo "On power" +fi + +for bat in /sys/class/power_supply/BAT? ; do + status=$(cat "$bat/status") + energy_full=$(cat "$bat/energy_full") + energy_now=$(cat "$bat/energy_now") + current_charge=$(bc <<< "scale=2; $energy_now / $energy_full * 100") + + printf '%s: %.0f%%\n' $(basename $bat) $current_charge +done -- cgit v1.2.3