From fb043e3ac2aadb412bdbff79324b6764b857e468 Mon Sep 17 00:00:00 2001 From: Janno Tjarks Date: Fri, 11 Feb 2022 17:38:01 +0100 Subject: [PATCH] Added the plugin spotify-tui --- README.md | 1 + scripts/dracula.sh | 5 +++++ scripts/spotify-tui.sh | 24 ++++++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100755 scripts/spotify-tui.sh diff --git a/README.md b/README.md index f4b3c51..952e038 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Configuration and options can be found at [draculatheme.com/tmux](https://dracul * When prefix is enabled smiley face turns from green to yellow * When charging, 'AC' is displayed * If forecast information is available, a ☀, ☁, ☂, or ❄ unicode character corresponding with the forecast is displayed alongside the temperature +* Spotify playback (needs the tool spotify-tui installed) ## Compatibility diff --git a/scripts/dracula.sh b/scripts/dracula.sh index 2b5e1f4..df07e5d 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -168,6 +168,11 @@ main() script="#($current_dir/network_ping.sh)" fi + if [ $plugin = "spotify-tui" ]; then + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-spotify-tui-colors" "green dark_gray") + script="#($current_dir/spotify-tui.sh)" + fi + if [ $plugin = "weather" ]; then # wait unit $datafile exists just to avoid errors # this should almost never need to wait unless something unexpected occurs diff --git a/scripts/spotify-tui.sh b/scripts/spotify-tui.sh new file mode 100755 index 0000000..dc07206 --- /dev/null +++ b/scripts/spotify-tui.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# setting the locale, some users have issues with different locales, this forces the correct one +export LC_ALL=en_US.UTF-8 + +current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source $current_dir/utils.sh + +main() +{ + # storing the refresh rate in the variable RATE, default is 5 + RATE=$(get_tmux_option "@dracula-refresh-rate" 5) + + if ! command -v spt &> /dev/null + then + exit 1 + fi + + spotify_playback=$(spt playback) + echo ${spotify_playback} + +} + +# run the main driver +main