You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.2 KiB
61 lines
1.2 KiB
#!/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() { |
|
if ip a | grep "inet " | grep -v 127 > /dev/null; then |
|
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
|
|
|