add dwmbar
This commit is contained in:
parent
1353a10bfd
commit
80a2cec7a2
|
@ -0,0 +1,63 @@
|
|||
#!/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 ping archlinux.org -c 1 > /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$(chargingp)"
|
||||
dispstr="$dispstr$(battery)"
|
||||
dispstr="$dispstr$(internetp)"
|
||||
dispstr="$dispstr$(current_time)"
|
||||
|
||||
xsetroot -name "$dispstr"
|
||||
sleep 1
|
||||
done
|
Loading…
Reference in New Issue