diff options
| author | BardofSprites <[email protected]> | 2026-02-02 18:58:54 -0500 |
|---|---|---|
| committer | BardofSprites <[email protected]> | 2026-02-02 18:58:54 -0500 |
| commit | 9610eedad062e9276b997650f27cd4cd1aa9291a (patch) | |
| tree | c9d036db7926aabfeba169532a9bffd96791c276 /bin | |
| parent | 966ac3f1b6ff4a8f1f56aca7cfb4c92642bf2a55 (diff) | |
fix clipping
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/.local/bin/scripts/status/music | 33 |
1 files changed, 12 insertions, 21 deletions
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")" |
