Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/ add max len to spotify and fix output when no device available #277

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Configuration and options can be found at [draculatheme.com/tmux](https://dracul
- When charging, 'AC' is displayed
- 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