aboutsummaryrefslogtreecommitdiff
path: root/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/rmpcover5
-rwxr-xr-x.local/bin/statusbar/sb-music21
2 files changed, 18 insertions, 8 deletions
diff --git a/.local/bin/rmpcover b/.local/bin/rmpcover
index 5ce77c4..0a312f6 100755
--- a/.local/bin/rmpcover
+++ b/.local/bin/rmpcover
@@ -1,5 +1,10 @@
#!/bin/sh
+ifrunning=$(mpc status | rg -o '\[\w+\] (.*)' | awk '{print $2}')
+if [ -z "$ifrunning" ]; then
+ echo ""
+fi
+
prefix="/mnt/ssd/music"
albumdir=$(rmpc song | jq -r '.file' | sed 's#/[^/]*$##')
final=$(fd . -e jpg -e png -t f "$prefix/$albumdir/" | head -n 1)
diff --git a/.local/bin/statusbar/sb-music b/.local/bin/statusbar/sb-music
index 647ed8d..dfa36f1 100755
--- a/.local/bin/statusbar/sb-music
+++ b/.local/bin/statusbar/sb-music
@@ -4,24 +4,28 @@ filter() {
artist_track=""
status_icon=""
modes=""
-
- # Flag to track if we've captured the artist and track name
track_info_captured=false
# Read input line by line
while IFS= read -r line; do
# Capture the first line with artist and track name
if [ "$track_info_captured" = false ]; then
+ # Check if the line contains typical status info (e.g., "volume:") instead of artist-track
+ if echo "$line" | grep -q "volume:"; then
+ # No song is playing, exit with empty output
+ echo ""
+ return
+ fi
artist_track="$line"
track_info_captured=true
- continue # Skip processing this line for playback modes
+ continue
fi
# Check for track status (paused or playing)
if echo "$line" | grep -q "\[paused\]"; then
status_icon=" "
elif echo "$line" | grep -q "\[playing\]"; then
- status_icon="" # Clear status_icon if playing
+ status_icon=""
fi
# Check for modes: consume, random, repeat, single
@@ -37,12 +41,11 @@ filter() {
if echo "$line" | grep -q "single: on"; then
modes="${modes}1 "
fi
-
done
- # After all lines have been processed, output the result
- if [ "$track_info_captured" = true ]; then
- # Trim the trailing space from modes if any
+ # After all lines processed, output the result only if artist_track is valid
+ if [ "$track_info_captured" = true ] && [ -n "$artist_track" ]; then
+ # Trim trailing space from modes if any
modes=$(echo "$modes" | sed 's/[[:space:]]*$//')
# Only add "|" if there are modes
@@ -51,6 +54,8 @@ filter() {
else
echo "$status_icon$artist_track"
fi
+ else
+ echo ""
fi
}