commit c522f9bb3911abf4edcc75fec61e0fd12500c257
parent 005356398672876b6284a5fd165c82c9d576bf13
Author: hhvn <dev@hhvn.uk>
Date: Tue, 8 Feb 2022 11:51:48 +0000
.s/dwmbar/: hide mus+net and fix stuff
Diffstat:
5 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/.scripts/dwmbar/bat b/.scripts/dwmbar/bat
@@ -6,7 +6,7 @@ total=100
"Charging") charging=y ;;
"Discharging") discharging=y ;;
esac
- charge=$(acpi | awk '{print $4}' | tr -d ',%')
+ charge=$(acpi | awk '{print $NF}' | tr -d ',%')
}
[ "$(uname)" = "OpenBSD" ] && {
diff --git a/.scripts/dwmbar/dwmbar b/.scripts/dwmbar/dwmbar
@@ -22,7 +22,7 @@ fn sigexit {
}
block vol
-block mus
+# block mus
while (true) {
block bat
block cpu
@@ -31,7 +31,7 @@ while (true) {
} &
while (true) {
- block mus
+ # block mus
block time2
sleep 1
} &
@@ -44,7 +44,7 @@ while (true) {
while (true) {
sleep 0.1
- xsetroot -name ``(''){cat mus bat net torrent cpu mem vol time time2 >[2]/dev/null |
+ xsetroot -name ``(''){cat mus bat torrent cpu mem vol time time2 >[2]/dev/null |
tr -d '\n' |
sed 's/^\[/^f4^/;s~\[~^c#000000^^r0,0,1,50^^d^^f4^~g;s~\]~^f4^~g'}
}
diff --git a/.scripts/dwmbar/mus b/.scripts/dwmbar/mus
@@ -0,0 +1,26 @@
+#!/bin/rc
+
+cmus-remote -Q | awk '
+/status paused/ {
+ print "[^c#7777cc^Paused]"
+ exit(1)
+}
+
+/^tag/ {
+ name = $0
+ sub(/[^ ]* /, "", name)
+ sub(/ .*/, "", name)
+ sub(/[^ ]* [^ ]* /, "")
+ metadata[name] = $0
+ p = 1
+}
+
+END {
+ if (p == 1) {
+ printf("[%s - %s - %s. %s]",
+ metadata["artist"],
+ metadata["album"],
+ metadata["tracknumber"],
+ metadata["title"])
+ }
+}' | tee curtxt
diff --git a/.scripts/dwmbar/restart b/.scripts/dwmbar/restart
@@ -1,4 +1,4 @@
#!/bin/rc
-doas kill `{pidof dwmbar}
+pkill dwmbar
dwmbar/dwmbar & >/dev/null >[2=1]
diff --git a/.scripts/dwmbar/time b/.scripts/dwmbar/time
@@ -7,7 +7,7 @@ echo $(curl wttr.in/?format=%s) > $HOME/.cache/wttrs
echo $(curl wttr.in/?format=%C) > $HOME/.cache/wttrC
day=$(date +%a | tr '[:lower:]' '[:upper:]')
-[ $(date +%u) -eq 6 ] || [ $(date +%u) -eq 7] && col="^c#007700^" || col="^c#888888^"
+[ $(date +%u) -eq 6 ] || [ $(date +%u) -eq 7 ] && col="^c#007700^" || col="^c#888888^"
month=$(date +%m)
[ $month -ge 3 ] && [ $month -le 5 ] && col2="^c#aaaa00^" #spring