diff options
author | Sam Chudnick <sam@chudnick.com> | 2023-06-11 07:49:11 -0400 |
---|---|---|
committer | Sam Chudnick <sam@chudnick.com> | 2023-06-11 07:49:11 -0400 |
commit | dfcc303e7cc284a45f55bae81ed888dc256432b8 (patch) | |
tree | b76835f53c0324c436c98e6838603c7bf838593f | |
parent | c833f67b5970dcd4f7e69ddabe4cb15300ef6749 (diff) |
Consolidated status bar scripts for dwmstatus
-rwxr-xr-x | .local/bin/bar | 53 | ||||
-rwxr-xr-x | .local/bin/statusbar/bar-calcurse | 15 | ||||
-rwxr-xr-x | .local/bin/statusbar/bar-cmus | 25 | ||||
-rwxr-xr-x | .local/bin/statusbar/bar-cpu | 7 | ||||
-rwxr-xr-x | .local/bin/statusbar/bar-gpu | 6 | ||||
-rwxr-xr-x | .local/bin/statusbar/bar-ipv4 | 9 | ||||
-rwxr-xr-x | .local/bin/statusbar/bar-memory | 8 | ||||
-rwxr-xr-x | .local/bin/statusbar/bar-storage | 7 | ||||
-rwxr-xr-x | .local/bin/statusbar/bar-time | 7 | ||||
-rwxr-xr-x | .local/bin/statusbar/bar-volume | 13 |
10 files changed, 53 insertions, 97 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 | |||
3 | black='#1d2021' | ||
4 | green='#b8bb26' | ||
5 | white='#ebdbb2' | ||
6 | grey='#a89984' | ||
7 | blue='#6f8faf' | ||
8 | red='#fb4934' | ||
9 | darkblue='#458588' | ||
10 | blue='#83a598' | ||
11 | darkred="#cc241d" | ||
12 | darkgreen="#98971a" | ||
13 | darkyellow="#d79921" | ||
14 | darkblue="#458588" | ||
15 | darkmagenta="#b16286" | ||
16 | darkcyan="#689d6a" | ||
17 | darkgrey="#928374" | ||
18 | yellow="#fabd2f" | ||
19 | magenta="#d3869b" | ||
20 | cyan="#8ec07c" | ||
21 | bground="#282828" | ||
22 | |||
23 | cpu() { | ||
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 | |||
33 | mem() { | ||
34 | printf "^c$blue^^b$bground^$(free -h | awk '/^Mem/ { print $3}' | sed s/i//g)" | ||
35 | } | ||
36 | |||
37 | |||
38 | volume() { | ||
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 | |||
43 | storage() { | ||
44 | printf "^c$darkyellow^^b$bground^ $(df -H | awk '/\/$/ { print $4 }')" | ||
45 | } | ||
46 | |||
47 | clock() { | ||
48 | printf "^c$black^^b$blue^ $(date +'%r') ^c$black^^b$darkblue^ $(date +'%A %D')" | ||
49 | } | ||
50 | |||
51 | while true; do | ||
52 | sleep 1 && xsetroot -name "$(cpu) $(mem) $(volume) $(storage) $(clock) " | ||
53 | done | ||
diff --git a/.local/bin/statusbar/bar-calcurse b/.local/bin/statusbar/bar-calcurse deleted file mode 100755 index dca82f3..0000000 --- a/.local/bin/statusbar/bar-calcurse +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | #i3blocks calcurse module | ||
4 | |||
5 | case $BUTTON in | ||
6 | 3)notify-send -t 5000 "$(calcurse -D ~/.config/calcurse/ -c ~/.config/calcurse/apts -a)";; | ||
7 | 1)notify-send -t 20000 "$(calcurse -D ~/.config/calcurse/ -c ~/.config/calcurse/apts -r7)";; | ||
8 | 2)notify-send -t 5000 "$(calcurse -D ~/.config/calcurse/ -t)" | ||
9 | esac | ||
10 | |||
11 | name="$(calcurse -D ~/.config/calcurse/ -c ~/.config/calcurse/apts -n | grep "\[" | sed "s/\s*\[/\[/" | cut -d ' ' -f 2-)" | ||
12 | [ "$name" = "" ] && echo "Nothing Scheduled" && exit 0 | ||
13 | time="$(grep "$name" ~/.config/calcurse/apts | head -1 | cut -d ' ' -f 3)" | ||
14 | [ ${time%%:*} -gt 12 ] && time="$((${time%%:*}-12)):${time##*:} PM" || time="$time AM" | ||
15 | echo "$name @ $time" | ||
diff --git a/.local/bin/statusbar/bar-cmus b/.local/bin/statusbar/bar-cmus deleted file mode 100755 index 947f950..0000000 --- a/.local/bin/statusbar/bar-cmus +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | case $BUTTON in | ||
4 | 1)notify-send "$(cmus-remote -Q | grep position | awk '{ printf "%02i:%02i", $2/60, $2%60}')/$(cmus-remote -Q | grep duration | awk '{ printf "%02i:%02i\n", $2/60, $2%60} ') ($(cmus-remote -Q | grep status | cut -d ' ' -f 2-)) | ||
5 | Artist: $(cmus-remote -Q | grep "tag artist " | cut -d ' ' -f 3-) | ||
6 | Album: $(cmus-remote -Q | grep "tag album " | cut -d ' ' -f 3-) | ||
7 | Track: $(cmus-remote -Q | grep "tag title " | cut -d ' ' -f 3-) | ||
8 | Genre: $(cmus-remote -Q | grep "tag genre " | cut -d ' ' -f 3-) | ||
9 | Mode: $(cmus-remote -Q | grep "aaa_mode" | cut -d ' ' -f 3) | ||
10 | Format: $(cmus-remote -Q | grep file | rev | cut -d '.' -f 1 | rev) | ||
11 | Shuffle: $(cmus-remote -Q | grep "set shuffle " | cut -d ' ' -f 3-) | ||
12 | Repeat: $(cmus-remote -Q | grep "set repeat_current " | cut -d ' ' -f 3-)";; | ||
13 | |||
14 | 3)urxvt -e vim ~/.local/bin/statusbar/cmus;; | ||
15 | 4)cmus-remote --next;; | ||
16 | 5)cmus-remote --prev;; | ||
17 | esac | ||
18 | |||
19 | pgrep -x cmus >/dev/null || exit 0 | ||
20 | |||
21 | status="$(cmus-remote -Q | grep status | cut -d ' ' -f 2)" | ||
22 | artist="$(cmus-remote -Q | grep "tag artist" | cut -d ' ' -f 3- | tr -d "\n")" | ||
23 | track="$(cmus-remote -Q | grep "tag title" | cut -d ' ' -f 3- | tr -d "\n")" | ||
24 | echo -n "$artist - $track" | ||
25 | [ "$status" = "playing" ] || echo -n " [P]" | ||
diff --git a/.local/bin/statusbar/bar-cpu b/.local/bin/statusbar/bar-cpu deleted file mode 100755 index 46f832b..0000000 --- a/.local/bin/statusbar/bar-cpu +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | case $BUTTON in | ||
3 | 1) notify-send "$(ps axc -o cmd:15,%cpu --sort=-%cpu | head -6)";; | ||
4 | 3) urxvt -e vim ~/.local/bin/statusbar/bar-cpu | ||
5 | esac | ||
6 | mpstat 1 1 | awk '/Average/ { printf "%.2f ",100-$12 }' | ||
7 | temp="$(sensors | awk '/Tctl/ { print $2 } ')"; echo -n ${temp#+} | ||
diff --git a/.local/bin/statusbar/bar-gpu b/.local/bin/statusbar/bar-gpu deleted file mode 100755 index 5351a2f..0000000 --- a/.local/bin/statusbar/bar-gpu +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | temp="$(sensors | awk '/edge/ { print $2 } ')" | ||
4 | fan="$(sensors | awk '/fan1/ { print $2 } ')" | ||
5 | power="$(sensors | awk '/power1/ { print $2 } ')" | ||
6 | echo -n "${temp#+} $fan RPM" | ||
diff --git a/.local/bin/statusbar/bar-ipv4 b/.local/bin/statusbar/bar-ipv4 deleted file mode 100755 index 85999bc..0000000 --- a/.local/bin/statusbar/bar-ipv4 +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | case $BUTTON in | ||
4 | 1)notify-send --expire-time=60000 "IP Addresses" "$(ip a | awk '/\/24|\/64/ {if($5=="temporary")print $2 " " $5;else print $2;}')";; | ||
5 | 3)urxvt -e ~/.local/bin/statusbar/bar-ipv4 | ||
6 | esac | ||
7 | ip a | awk '/\/24/ { print $2 }' | cut -d '/' -f 1 | ||
8 | |||
9 | |||
diff --git a/.local/bin/statusbar/bar-memory b/.local/bin/statusbar/bar-memory deleted file mode 100755 index 44a8ed3..0000000 --- a/.local/bin/statusbar/bar-memory +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | case $BUTTON in | ||
4 | 1)notify-send "$(ps axc -o cmd:15,%mem --sort=-%mem | head -6)";; | ||
5 | 3)urxvt -e vim ~/.local/bin/statusbar/bar-memory | ||
6 | esac | ||
7 | free --si -h | grep Mem | awk '{ print $3 "/" $2 }' | ||
8 | |||
diff --git a/.local/bin/statusbar/bar-storage b/.local/bin/statusbar/bar-storage deleted file mode 100755 index a162834..0000000 --- a/.local/bin/statusbar/bar-storage +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | case $BUTTON in | ||
4 | 1)notify-send "$(df -H | grep "Filesystem\|/dev/sd\|/dev/mapper")";; | ||
5 | 3)urxvt -e vim ~/.local/bin/statusbar/storage | ||
6 | esac | ||
7 | df -H | awk '/\/$/ { print $4 }' | ||
diff --git a/.local/bin/statusbar/bar-time b/.local/bin/statusbar/bar-time deleted file mode 100755 index 781ba8f..0000000 --- a/.local/bin/statusbar/bar-time +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | case $BUTTON in | ||
4 | 1)notify-send "$(ncal -hb)";; | ||
5 | 3)urxvt -e vim ~/.local/bin/statusbar/bar-time | ||
6 | esac | ||
7 | date +"%r %A %D" | ||
diff --git a/.local/bin/statusbar/bar-volume b/.local/bin/statusbar/bar-volume deleted file mode 100755 index b67c6ca..0000000 --- a/.local/bin/statusbar/bar-volume +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # i3blocks volume module | ||
3 | |||
4 | case $BUTTON in | ||
5 | 1)urxvt -e alsamixer;; | ||
6 | 3)urxvt -e vim ~/.local/bin/statusbar/bar-volume;; | ||
7 | 4)amixer -q sset Master 1%+ unmute;; | ||
8 | 5)amixer -q sset Master 1%- unmute;; | ||
9 | esac | ||
10 | |||
11 | stats=$(amixer sget Master | grep "Front Left:" | cut -d ' ' -f 7,8 | tr -d '[]') | ||
12 | [ "${stats##* }" = "on" ] && echo -n "${stats%% *}" || echo -n "${stats%% *}" | ||
13 | |||