2021-05-06 18:21:44 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
SEP=" / "
|
|
|
|
|
|
|
|
keyboard() {
|
|
|
|
printf "KEY %s" "$(setxkbmap -query | awk '/layout/{print $2}')"
|
|
|
|
printf "$SEP\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
alsa() {
|
|
|
|
STATUS=$(amixer sget Master | tail -n1 | sed -r "s/.*\[(.*)\]/\1/")
|
|
|
|
VOL=$(amixer get Master | tail -n1 | sed -r "s/.*\[(.*)%\].*/\1/")
|
|
|
|
|
|
|
|
if echo "$STATUS" | grep -q "off"; then
|
|
|
|
printf "VOL muted"
|
|
|
|
else
|
|
|
|
printf "VOL %s%%" "$VOL"
|
|
|
|
fi
|
|
|
|
printf "$SEP\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
chargingp() {
|
|
|
|
state=`cat /sys/class/power_supply/BAT0/status`
|
|
|
|
printf "BAT "
|
|
|
|
if cat /sys/class/power_supply/BAT0/status | grep -q "Discharging"; then
|
|
|
|
printf "%b " "-"
|
|
|
|
else
|
|
|
|
printf "%b " "+"
|
|
|
|
fi
|
|
|
|
printf "\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
battery() {
|
|
|
|
printf "`cat /sys/class/power_supply/BAT0/capacity`%%"
|
|
|
|
printf "$SEP\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
internetp() {
|
2021-05-06 19:08:42 +00:00
|
|
|
if ip a | grep "inet " | grep -v 127 > /dev/null; then
|
2021-05-06 18:21:44 +00:00
|
|
|
printf "NET connected"
|
|
|
|
else
|
|
|
|
printf "NET disconnected"
|
|
|
|
fi
|
|
|
|
printf "$SEP\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
current_time() {
|
|
|
|
printf "$(date +%R)"
|
|
|
|
printf "$SEP\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
dispstr=""
|
|
|
|
dispstr="$dispstr$(keyboard)"
|
|
|
|
dispstr="$dispstr$(alsa)"
|
|
|
|
dispstr="$dispstr$(internetp)"
|
|
|
|
dispstr="$dispstr$(current_time)"
|
|
|
|
|
|
|
|
xsetroot -name "$dispstr"
|
|
|
|
sleep 1
|
|
|
|
done
|