-
Notifications
You must be signed in to change notification settings - Fork 1
/
spotify-info.tmux
executable file
·32 lines (25 loc) · 789 Bytes
/
spotify-info.tmux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ "$(uname)" == "Darwin" ]; then
spotify_info="#($CURRENT_DIR/scripts/tmux-spotify-info)"
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
spotify_info="#($CURRENT_DIR/scripts/spotify-dbus.sh)"
fi
placeholder="\#{spotify-info}"
source $CURRENT_DIR/scripts/utils.sh
do_interpolation() {
local string="$1"
local interpolated="${string/$placeholder/$spotify_info}"
echo "$interpolated"
}
update_tmux_option() {
local option="$1"
local option_value="$(get_tmux_option "$option")"
local new_option_value="$(do_interpolation "$option_value")"
set_tmux_option "$option" "$new_option_value"
}
main() {
update_tmux_option "status-left"
update_tmux_option "status-right"
}
main