dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 7eebdcefc8e70d1594df810447b07924e4b91562
parent 00c2c9ca624a054b1e9e24192671f713ce58689b
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Sat, 25 May 2019 20:42:03 +0200

Fix battery status and trim extra trailing whitespace

Diffstat:
M.local/bin/sysstatus | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/.local/bin/sysstatus b/.local/bin/sysstatus @@ -8,11 +8,12 @@ keymap=$(setxkbmap -print | sed -n '5s/^.*pc+//;5s/+.*$//;5p') vol=$(pulsemixer --get-volume | cut -d' ' -f1) cputemp=$(sed 's/[0-9][0-9][0-9]$//' /sys/class/thermal/thermal_zone0/temp) cpuload=$(cut -d' ' -f1 /proc/loadavg) -batstatus=$(sed 's/Charging/+/;s/Discharging/-/' \ +batstatus=$(sed -n 's/Charging/+/;s/Discharging/-/' \ /sys/class/power_supply/${battery}/status | sed 's/Unknown//') batlvl=$(cat /sys/class/power_supply/${battery}/capacity) batremain=$(acpi -b | sed 1q |\ sed -n 's/.*\([0-9][0-9]*:[0-9][0-9]\):[0-9][0-9].*/\1/') +battery="$(echo "${batstatus}${batlvl}% ${batremain}" | sed 's/ $//')" wlanssid=$(iwgetid -r $wlandev) wlanquality=$(echo \ "0$(grep $wlandev /proc/net/wireless | awk '{print $3}')/70 * 100" |\ @@ -20,6 +21,6 @@ wlanquality=$(echo \ date=$(date +'%F %T') status="${mail}${music} ${keymap} | ♪ ${vol}% | ${cputemp}°C ${cpuload} |\ - ${batstatus}${batlvl}% ${batremain} | ${wlanssid} ${wlanquality}% | $date" + ${battery} | ${wlanssid} ${wlanquality}% | $date" printf "%s" "$status"