summaryrefslogtreecommitdiff
path: root/.local/bin/bar
blob: 16481197f37db952a17b66799c58462f081c57bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh

black='#1d2021'
green='#b8bb26'
white='#ebdbb2'
grey='#a89984'
blue='#6f8faf'
red='#fb4934'
darkblue='#458588'
blue='#83a598'
darkred="#cc241d"
darkgreen="#98971a"
darkyellow="#d79921"
darkblue="#458588"
darkmagenta="#b16286"
darkcyan="#689d6a"
darkgrey="#928374"
yellow="#fabd2f"
magenta="#d3869b"
cyan="#8ec07c"
bground="#282828"

cpu() {
	cpu="$(mpstat 1 1 | awk '/Average/ { printf "%.2f ",100-$12 }')"
	temp="$(sensors | awk '/Tctl/ { print $2 } ' | tr -d '+')"

	printf "^c$black^^b$cyan^ CPU"
	printf "^c$black^^b$cyan^ $cpu%%"
	printf "^c$black^^b$cyan^ $temp "
	printf "^c$bground^^b$bground^"
}

mem() {
	printf "^c$blue^^b$bground^$(free -h | awk '/^Mem/ { print $3}' | sed s/i//g)"
}


volume() {
	stats=$(amixer sget Master | grep "Front Left:" | cut -d ' ' -f 7,8 | tr -d '[]')
	[ "${stats##* }" = "on" ] && echo -n "^c$green^^b$black^ ${stats%% *}" || echo -n "^c$yellow^^b$darkgrey^ ${stats%% *}"
}

storage() {
	printf "^c$darkyellow^^b$bground^ $(df -H | awk '/\/$/ { print $4 }')"
}

clock() {
		printf "^c$black^^b$blue^ $(date +'%r') ^c$black^^b$darkblue^ $(date +'%A %D')"
}

while true; do
		sleep 1 && xsetroot -name "$(cpu) $(mem) $(volume) $(storage) $(clock) "
done