diff options
author | awy <awy@awy.one> | 2025-08-07 04:38:05 +0300 |
---|---|---|
committer | awy <awy@awy.one> | 2025-08-07 04:38:05 +0300 |
commit | 82307a7d73dc2683062e1029b98bf976fb50ee26 (patch) | |
tree | d3881c27a086f4210ebd3d463391ae21b27af4ad /.local | |
parent | 500d06abcd465c606c9503fc883a63f3a48028f7 (diff) | |
download | hyprdots-82307a7d73dc2683062e1029b98bf976fb50ee26.tar.gz |
music module update
Diffstat (limited to '.local')
-rwxr-xr-x | .local/bin/rmpcover | 5 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-music | 21 |
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 } |