This repository has been archived on 2023-01-01. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles-old/.local/bin/owobar
2020-12-23 13:44:21 -03:00

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