dgy
/
hexagons
Archived
1
0
Fork 0
This repository has been archived on 2021-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
hexagons/.local/bin/txbar

32 lines
877 B
Bash
Executable File

#!/bin/sh
if [ -z $DISPLAY ]; then
HEART='B'
WIFI='W'
THERM='T'
else
HEART=' '
WIFI='直'
THERM=' '
fi
MAIL='@'
if [ -d /sys/class/power_supply/BAT0 ]; then
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}')
printf '#[fg=colour123] %s' "$HEART $current_charge"
fi
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"
fi
temp="$(sensors | awk '(/Core 0/){printf $3}' | sed 's/\.0//; s/+//')"
printf '#[fg=default] %s' "$THERM$temp"