From 9610eedad062e9276b997650f27cd4cd1aa9291a Mon Sep 17 00:00:00 2001 From: BardofSprites <89086143+BardofSprites@users.noreply.github.com> Date: Mon, 2 Feb 2026 18:58:54 -0500 Subject: fix clipping --- bin/.local/bin/scripts/status/music | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) (limited to 'bin/.local') diff --git a/bin/.local/bin/scripts/status/music b/bin/.local/bin/scripts/status/music index 724a7ca..5b5b5fb 100755 --- a/bin/.local/bin/scripts/status/music +++ b/bin/.local/bin/scripts/status/music @@ -3,27 +3,21 @@ # Music module script for dwmblocks truncate() { - echo "$1" | cut -c1-15 + echo "$1" | cut -c1-30 } # Handle mouse events based on button clicks case $BLOCK_BUTTON in - 1) # Left click to pause/play - playerctl play-pause + 1) playerctl play-pause pkill -RTMIN+10 "${STATUSBAR:-dwmblocks}" ;; - 2) # Middle click to open the music player - # Replace `your-music-player` with your actual music player command - emacs-launcher "music" & ;; - 3) # Right click to show notification - notify-send "🎵 Music Module + 2) emacs-launcher "music" & ;; + 3) notify-send "🎵 Music Module - Left click to play/pause. - Middle click to open music player. - Right click to show current track." ;; - 4) # Scroll up to go back - playerctl previous + 4) playerctl previous pkill -RTMIN+10 "${STATUSBAR:-dwmblocks}" ;; - 5) # Scroll down to skip - playerctl next + 5) playerctl next pkill -RTMIN+10 "${STATUSBAR:-dwmblocks}" ;; esac @@ -31,12 +25,8 @@ esac artist="$(playerctl metadata artist 2>/dev/null || echo "none")" title="$(playerctl metadata title 2>/dev/null || echo "none")" -# Truncate artist and title to 15 characters -truncated_artist=$(truncate "$artist") -truncated_title=$(truncate "$title") - -# Format the output as "artist - title" -current_track="$truncated_artist - $truncated_title" +# Format full track string +current_track="$artist - $title" playerstatus=$(playerctl status) @@ -44,8 +34,9 @@ case "$playerstatus" in "Playing") icon="🎵" ;; "Paused") icon="⏸️" ;; "Stopped") icon="⏹️" ;; - "*") icon="" ;; + *) icon="" ;; esac -# Print the current track -echo "$icon $current_track" +# Combine icon and track, then truncate to 15 chars +output="$icon $current_track" +echo "$(truncate "$output")" -- cgit v1.2.3