diff --git a/README.md b/README.md index 2eaef0fc..1ecc799a 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Configuration and options can be found at [draculatheme.com/tmux](https://dracul `set -g @dracula-show-battery-status true` - If forecast information is available, a ☀, ☁, ☂, or ❄ unicode character corresponding with the forecast is displayed alongside the temperature - Info if the Panes are synchronized -- Spotify playback (needs the tool spotify-tui installed) +- Spotify playback (needs the tool spotify-tui installed). max-len can be configured. - Music Player Daemon status (needs the tool mpc installed) - Playerctl, get current track metadata - Current kubernetes context diff --git a/scripts/spotify-tui.sh b/scripts/spotify-tui.sh index 33ff32f3..ab6e39d7 100755 --- a/scripts/spotify-tui.sh +++ b/scripts/spotify-tui.sh @@ -15,10 +15,20 @@ main() exit 1 fi + if [ "$(spt list --devices)" = "No devices available" ] + then + echo "" + exit 0 + fi + FORMAT=$(get_tmux_option "@dracula-spotify-tui-format" "%f %s %t - %a") spotify_playback=$(spt playback -f "${FORMAT}") - echo ${spotify_playback} - + max_len=$(get_tmux_option "@dracula-spotify-tui-max-len" 0) + if [[ $max_len -ne 0 ]] ; then + echo ${spotify_playback} | head -c $max_len + else + echo ${spotify_playback} + fi } # run the main driver