commit 2035756abee8853f4c400852b633b92a8f8a29ef
parent 58e058ca18a98d362461fb9a81685430fa9ddb17
Author: Alex Balgavy <alexander.balgavy@spaceapplications.com>
Date: Fri, 9 Feb 2024 20:57:13 +0100
improve dwmblocks scripts
Diffstat:
2 files changed, 28 insertions(+), 7 deletions(-)
diff --git a/scripts/dwmblock-iss b/scripts/dwmblock-iss
@@ -1,7 +1,8 @@
#!/bin/sh
-iss_stream="https://www.youtube.com/watch?v=P9C25Un7xaM"
+iss_stream_1="https://www.youtube.com/watch?v=P9C25Un7xaM"
+iss_stream_2="https://www.youtube.com/watch?v=jPTD2gnZFUw"
show_iss_stream() {
- setsid -f mpv --no-osc --loop=inf --no-terminal --profile=low-latency "$iss_stream" ;
+ setsid -f mpv --no-osc --loop=inf --no-terminal --profile=low-latency "$1" ;
notify "ISS Tracker" "Opening stream..."
}
@@ -21,11 +22,13 @@ get_iss_diagram() {
showimg() { setsid -f nsxiv "$1" ;}
case $BUTTON in
- 1) case "$(printf 'Map\nStream\nDiagram' | dmenu -i -l 3 -p "Choose:")" in
+ 1) case "$(printf 'Map\nStream 1\nStream 2\nDiagram' | dmenu -i -l 3 -p "Choose:")" in
'Map')
get_iss_pos && showimg "$iss_img";;
- 'Stream')
- show_iss_stream;;
+ 'Stream 1')
+ show_iss_stream "$iss_stream_1";;
+ 'Stream 2')
+ show_iss_stream "$iss_stream_2";;
'Diagram')
get_iss_diagram && showimg "$iss_diagram";;
*);;
diff --git a/scripts/dwmblock-volume b/scripts/dwmblock-volume
@@ -27,7 +27,16 @@ case $(pactl get-sink-mute "$sink") in
esac
volume="$(pactl get-sink-volume "$sink" \
| head -n 1 \
- | awk -v volume_icon="$volume_icon" -F ' / ' '{gsub(" ", "", $2); gsub(" ", "", $4); printf("%s %s %s", volume_icon, $2,$4)}')"
+ | awk -v volume_icon="$volume_icon" -F ' / ' '{
+ gsub(" ", "", $2);
+ gsub(" ", "", $4);
+ if ($2 == $4) {
+ printf("%s %s", volume_icon, $2);
+ }
+ else {
+ printf("%s %s %s", volume_icon, $2, $4);
+ }
+ }')"
case $(pactl get-source-mute "$source") in
"Mute: yes"*)
@@ -41,6 +50,15 @@ esac
pgrep -f nerd-dictation >/dev/null 2>&1 && recording=' ⏺'
mic="$(pactl get-source-volume "$source" \
| head -n 1 \
- | awk -v mic_icon="$mic_icon" -F ' / ' '{gsub(" ", "", $2); gsub(" ", "", $4); printf("%s %s %s", mic_icon, $2,$4)}')"
+ | awk -v mic_icon="$mic_icon" -F ' / ' '{
+ gsub(" ", "", $2);
+ gsub(" ", "", $4);
+ if ($2 == $4) {
+ printf("%s %s", mic_icon, $2);
+ }
+ else {
+ printf("%s %s %s", mic_icon, $2);
+ }
+ }')"
printf "%s %s%s" "$volume" "$mic" "$recording"