Skip to content

Commit

Permalink
Merge pull request #277 from Theoreticallyhugo/feature/spt-overflow
Browse files Browse the repository at this point in the history
feature/ add max len to spotify and fix output when no device available
  • Loading branch information
ethancedwards8 authored Aug 19, 2024
2 parents 36217d1 + 4c260ce commit 40edba4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions scripts/spotify-tui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 40edba4

Please sign in to comment.