sb cleanup
This commit is contained in:
parent
26cfe3dfcc
commit
2826c56202
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/sh
|
||||||
|
red="\033[31m"
|
||||||
|
orange="\033[33m"
|
||||||
|
cyan="\033[36m"
|
||||||
|
green="\033[32m"
|
||||||
|
white="\033[37m"
|
||||||
|
reset="\033[0m"
|
||||||
|
for battery in /sys/class/power_supply/BAT?*; do
|
||||||
|
[ -n "${capacity+x}" ] && printf " "
|
||||||
|
capacity="$(cat "$battery/capacity" 2>&1)"
|
||||||
|
case "$(cat "$battery/status" 2>&1)" in
|
||||||
|
"Full") icon=""; color="$green" ;;
|
||||||
|
"Charging") icon=""; color="$cyan" ;;
|
||||||
|
"Not charging") icon=""; color="$white" ;;
|
||||||
|
"Unknown") icon=""; color="$orange" ;;
|
||||||
|
"Discharging")
|
||||||
|
if [ "$capacity" -le 10 ]; then
|
||||||
|
icon=""; color="$red"
|
||||||
|
elif [ "$capacity" -le 20 ]; then
|
||||||
|
icon=""; color="$red"
|
||||||
|
elif [ "$capacity" -le 30 ]; then
|
||||||
|
icon=""; color="$white"
|
||||||
|
elif [ "$capacity" -le 40 ]; then
|
||||||
|
icon=""; color="$white"
|
||||||
|
elif [ "$capacity" -le 50 ]; then
|
||||||
|
icon=""; color="$white"
|
||||||
|
elif [ "$capacity" -le 60 ]; then
|
||||||
|
icon=""; color="$white"
|
||||||
|
elif [ "$capacity" -le 70 ]; then
|
||||||
|
icon=""; color="$white"
|
||||||
|
elif [ "$capacity" -le 80 ]; then
|
||||||
|
icon=""; color="$white"
|
||||||
|
elif [ "$capacity" -le 90 ]; then
|
||||||
|
icon=""; color="$white"
|
||||||
|
else
|
||||||
|
icon=""; color="$white"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*) exit 1 ;;
|
||||||
|
esac
|
||||||
|
printf "$color%s$reset %d%%" "$icon" "$capacity";
|
||||||
|
done && printf "\\n"
|
|
@ -21,5 +21,5 @@ echo "$stats" | while read -r row; do
|
||||||
"6"|"7"|"8") printf "\033[31m▇";;
|
"6"|"7"|"8") printf "\033[31m▇";;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
done; printf "\033[0m\\n"
|
done; printf "\033[0m\n"
|
||||||
echo "$stats" > "$cache"
|
echo "$stats" > "$cache"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/
|
# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/
|
||||||
loc_addr="$(ip route get 9.9.9.9 | head -1 | cut -d ' ' -f3)"
|
loc_addr="$(ip route get 9.9.9.9 | head -1 | cut -d ' ' -f7)"
|
||||||
pub_addr="$(curl snaile.de/ip 2>/dev/null)" || exit
|
pub_addr="$(curl icanhazip.com 2>/dev/null)" || exit
|
||||||
# flag="$(grep "flag: " "${XDG_DATA_HOME:-$HOME/.local/share}/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed 's/ flag: .*//')"
|
# flag="$(grep "flag: " "${XDG_DATA_HOME:-$HOME/.local/share}/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed 's/ flag: .*//')"
|
||||||
printf "%s %s\n" "$loc_addr" "$pub_addr"
|
printf "%s %s\n" "$loc_addr" "$pub_addr"
|
||||||
|
|
Loading…
Reference in New Issue