From a486050c221bb8eec1601c32807e35219a6ee49c Mon Sep 17 00:00:00 2001 From: pspiagicw Date: Thu, 19 Oct 2023 15:48:43 +0530 Subject: [PATCH] feat: Added mpc plugin --- scripts/dracula.sh | 6 +++++- scripts/mpc.sh | 25 +++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100755 scripts/mpc.sh diff --git a/scripts/dracula.sh b/scripts/dracula.sh index 7639e63..6ba6f0c 100755 --- a/scripts/dracula.sh +++ b/scripts/dracula.sh @@ -148,7 +148,7 @@ main() IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-cwd-colors" "dark_gray white") tmux set-option -g status-right-length 250 script="#($current_dir/cwd.sh)" - + elif [ $plugin = "fossil" ]; then IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-fossil-colors" "green dark_gray") tmux set-option -g status-right-length 250 @@ -213,6 +213,10 @@ main() IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-attached-clients-colors" "cyan dark_gray") script="#($current_dir/attached_clients.sh)" + elif [ $plugin = "mpc" ]; then + IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-spotify-tui-colors" "green dark_gray") + script="#($current_dir/mpc.sh)" + elif [ $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)" diff --git a/scripts/mpc.sh b/scripts/mpc.sh new file mode 100755 index 0000000..f75c261 --- /dev/null +++ b/scripts/mpc.sh @@ -0,0 +1,25 @@ +#!/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 mpc &> /dev/null + then + exit 1 + fi + + # FORMAT=$(get_tmux_option "@dracula-spotify-tui-format" "%f %s %t - %a") + mpc_playback=$(mpc current) + echo ${mpc_playback} + +} + +# run the main driver +main