42 lines
710 B
Bash
Executable file
42 lines
710 B
Bash
Executable file
#!/bin/sh
|
|
|
|
hostname() {
|
|
cat /etc/hostname
|
|
}
|
|
|
|
clock() {
|
|
date +%H:%M
|
|
}
|
|
|
|
clocktick() {
|
|
date +%H\ %M
|
|
}
|
|
|
|
battery() {
|
|
cat /sys/class/power_supply/BAT1/capacity
|
|
}
|
|
|
|
wifi() {
|
|
iwgetid -r
|
|
}
|
|
|
|
cpu() {
|
|
top -bn1 | grep "Cpu(s)" | \
|
|
sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | \
|
|
awk '{print int(100 - $1)}'
|
|
}
|
|
|
|
mem() {
|
|
free -m | grep Mem | awk '{print int(($3/$2)*100)}'
|
|
}
|
|
|
|
while true; do
|
|
BAR_INPUT="%{B#20000000}%{l} $(hostname) %{c}CPU: $(cpu)% | MEM: $(mem)% | BAT: $(battery)% | NET: $(wifi) %{r}$(clock)"
|
|
echo $BAR_INPUT
|
|
sleep 1
|
|
BAR_INPUT="%{B#20000000}%{l} $(hostname) %{c}CPU: $(cpu)% | MEM: $(mem)% | BAT: $(battery)% | NET: $(wifi)
|
|
%{r}$(clocktick)"
|
|
echo $BAR_INPUT
|
|
sleep 1
|
|
done
|