2020-05-27 02:31:42 +00:00
|
|
|
#!/bin/sh
|
2018-02-04 16:14:51 +00:00
|
|
|
|
2021-02-20 02:49:48 +00:00
|
|
|
if [ -z $DISPLAY ]; then
|
|
|
|
HEART='B'
|
2021-03-24 07:00:29 +00:00
|
|
|
WIFI='W'
|
2021-02-20 02:49:48 +00:00
|
|
|
THERM='T'
|
|
|
|
else
|
|
|
|
HEART=' '
|
|
|
|
WIFI='直'
|
2021-03-24 07:00:29 +00:00
|
|
|
THERM=' '
|
2021-02-20 02:49:48 +00:00
|
|
|
fi
|
|
|
|
MAIL='@'
|
2018-02-04 16:14:51 +00:00
|
|
|
|
|
|
|
if [ -d /sys/class/power_supply/BAT0 ]; then
|
2020-05-27 02:31:42 +00:00
|
|
|
battery_info="$(head -n 1 /sys/class/power_supply/BAT0/capacity)%"
|
|
|
|
current_charge=$(echo "$battery_info" | grep -o '[0-9]\+%' | awk '{sub (/%/, "", $1); print $1}')
|
2021-03-24 07:00:29 +00:00
|
|
|
printf '#[fg=colour123] %s' "$HEART $current_charge"
|
2018-02-04 16:14:51 +00:00
|
|
|
fi
|
|
|
|
|
2021-02-20 02:49:48 +00:00
|
|
|
unread="$(find "$XDG_DATA_HOME"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)"
|
|
|
|
if [ "$unread" -gt 0 ]; then
|
|
|
|
printf ' %s' "$MAIL$unread"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$(cat /sys/class/net/w*/operstate)" = up ]; then
|
|
|
|
net="$(awk '/^\s*w/ { print int($3 * 100 / 70) }' /proc/net/wireless)"
|
|
|
|
printf '#[fg=colour184] %s' "$WIFI$net"
|
2018-02-12 06:07:29 +00:00
|
|
|
fi
|
2020-08-28 16:11:06 +00:00
|
|
|
|
|
|
|
temp="$(sensors | awk '(/Core 0/){printf $3}' | sed 's/\.0//; s/+//')"
|
2021-03-24 07:00:29 +00:00
|
|
|
printf '#[fg=default] %s' "$THERM$temp"
|