summaryrefslogtreecommitdiff
path: root/.local/bin/bar
diff options
context:
space:
mode:
authorSam Chudnick <sam@chudnick.com>2023-06-11 07:49:11 -0400
committerSam Chudnick <sam@chudnick.com>2023-06-11 07:49:11 -0400
commitdfcc303e7cc284a45f55bae81ed888dc256432b8 (patch)
treeb76835f53c0324c436c98e6838603c7bf838593f /.local/bin/bar
parentc833f67b5970dcd4f7e69ddabe4cb15300ef6749 (diff)
Consolidated status bar scripts for dwmstatus
Diffstat (limited to '.local/bin/bar')
-rwxr-xr-x.local/bin/bar53
1 files changed, 53 insertions, 0 deletions
diff --git a/.local/bin/bar b/.local/bin/bar
new file mode 100755
index 0000000..1648119
--- /dev/null
+++ b/.local/bin/bar
@@ -0,0 +1,53 @@
1#!/bin/sh
2
3black='#1d2021'
4green='#b8bb26'
5white='#ebdbb2'
6grey='#a89984'
7blue='#6f8faf'
8red='#fb4934'
9darkblue='#458588'
10blue='#83a598'
11darkred="#cc241d"
12darkgreen="#98971a"
13darkyellow="#d79921"
14darkblue="#458588"
15darkmagenta="#b16286"
16darkcyan="#689d6a"
17darkgrey="#928374"
18yellow="#fabd2f"
19magenta="#d3869b"
20cyan="#8ec07c"
21bground="#282828"
22
23cpu() {
24 cpu="$(mpstat 1 1 | awk '/Average/ { printf "%.2f ",100-$12 }')"
25 temp="$(sensors | awk '/Tctl/ { print $2 } ' | tr -d '+')"
26
27 printf "^c$black^^b$cyan^ CPU"
28 printf "^c$black^^b$cyan^ $cpu%%"
29 printf "^c$black^^b$cyan^ $temp "
30 printf "^c$bground^^b$bground^"
31}
32
33mem() {
34 printf "^c$blue^^b$bground^$(free -h | awk '/^Mem/ { print $3}' | sed s/i//g)"
35}
36
37
38volume() {
39 stats=$(amixer sget Master | grep "Front Left:" | cut -d ' ' -f 7,8 | tr -d '[]')
40 [ "${stats##* }" = "on" ] && echo -n "^c$green^^b$black^ ${stats%% *}" || echo -n "^c$yellow^^b$darkgrey^ ${stats%% *}"
41}
42
43storage() {
44 printf "^c$darkyellow^^b$bground^ $(df -H | awk '/\/$/ { print $4 }')"
45}
46
47clock() {
48 printf "^c$black^^b$blue^ $(date +'%r') ^c$black^^b$darkblue^ $(date +'%A %D')"
49}
50
51while true; do
52 sleep 1 && xsetroot -name "$(cpu) $(mem) $(volume) $(storage) $(clock) "
53done