56 lines
1.3 KiB
Plaintext
56 lines
1.3 KiB
Plaintext
|
#!/bin/bash
|
||
|
black=#0f0f0f
|
||
|
green=#74be88
|
||
|
white=#dfdde0
|
||
|
grey=#212126
|
||
|
darkblue=#6d92b7
|
||
|
red=#da696d
|
||
|
blue=#6692bf
|
||
|
yellow=#e1b56a
|
||
|
interval=0
|
||
|
|
||
|
battery() {
|
||
|
BAT_ICON=$(~/.local/bin/battery --icon)
|
||
|
get_capacity="$(cat /sys/class/power_supply/BAT0/capacity)%%"
|
||
|
printf "^c$green^ $BAT_ICON $get_capacity"
|
||
|
}
|
||
|
|
||
|
volume() {
|
||
|
VOL_ICON="$(~/.local/bin/volume)"
|
||
|
VOLUME=$(pamixer --get-volume)
|
||
|
printf "^c$blue^ $VOL_ICON $VOLUME%%"
|
||
|
}
|
||
|
|
||
|
wlan() {
|
||
|
SSID=$(iwgetid -r)
|
||
|
case "$(cat /sys/class/net/wl*/operstate 2>/dev/null)" in
|
||
|
up) printf "\x02^c$black^^b$blue^ ^d^%s""^c$blue^^b$grey^ $SSID ^b$black^" ;;
|
||
|
down) printf "\x02^c$black^^b$blue^ ^d^%s""^c$blue^^b$grey^ Disconnected ^b$black^" ;;
|
||
|
esac
|
||
|
}
|
||
|
|
||
|
clock() {
|
||
|
printf "\x03^c$black^^b$darkblue^ "
|
||
|
printf "^c$black^^b$blue^ $(date '+%H:%M') ^b$black^"
|
||
|
}
|
||
|
|
||
|
mem() {
|
||
|
MEM=$(free -h | awk '/^Mem/ { print $3 }' | sed s/i//g)
|
||
|
printf "^b$red^^c$black^ ^b$grey^^c$red^ $MEM ^b$black^"
|
||
|
}
|
||
|
|
||
|
cpu() {
|
||
|
CPU=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}')
|
||
|
printf "^c$grey^^b$green^ CPU ^c$green^^b$grey^ ${CPU} ^b$black^"
|
||
|
}
|
||
|
|
||
|
powermenu(){
|
||
|
printf "\x01^c$red^^b$grey^ "
|
||
|
}
|
||
|
|
||
|
|
||
|
while true; do
|
||
|
interval=$((interval + 1))
|
||
|
sleep 1 && xsetroot -name "$(volume) $(battery) $(wlan) $(clock) $(powermenu)"
|
||
|
done
|