-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathspotify.tmux
executable file
·62 lines (47 loc) · 2.06 KB
/
spotify.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/scripts/helpers.sh"
spotify_status="#($CURRENT_DIR/scripts/spotify_status.sh)"
spotify_status_interpolation="\#{spotify_status}"
spotify_status_full="#($CURRENT_DIR/scripts/spotify_status_full.sh)"
spotify_status_full_interpolation="\#{spotify_status_full}"
spotify_song="#($CURRENT_DIR/scripts/spotify_song.sh)"
spotify_song_interpolation="\#{spotify_song}"
spotify_song_full="#($CURRENT_DIR/scripts/spotify_song_full.sh)"
spotify_song_full_interpolation="\#{spotify_song_full}"
spotify_artist="#($CURRENT_DIR/scripts/spotify_artist.sh)"
spotify_artist_interpolation="\#{spotify_artist}"
spotify_artist_full="#($CURRENT_DIR/scripts/spotify_artist_full.sh)"
spotify_artist_full_interpolation="\#{spotify_artist_full}"
spotify_album="#($CURRENT_DIR/scripts/spotify_album.sh)"
spotify_album_interpolation="\#{spotify_album}"
spotify_playback="#($CURRENT_DIR/scripts/spotify_playback.sh)"
spotify_playback_interpolation="\#{spotify_playback}"
set_tmux_option() {
local option="$1"
local value="$2"
tmux set-option -gq "$option" "$value"
}
do_interpolation() {
local string=$1
local string=${string/$spotify_status_interpolation/$spotify_status}
local string=${string/$spotify_status_full_interpolation/$spotify_status_full}
local string=${string/$spotify_song_interpolation/$spotify_song}
local string=${string/$spotify_song_full_interpolation/$spotify_song_full}
local string=${string/$spotify_artist_interpolation/$spotify_artist}
local string=${string/$spotify_artist_full_interpolation/$spotify_artist_full}
local string=${string/$spotify_album_interpolation/$spotify_album}
local string=${string/$spotify_playback_interpolation/$spotify_playback}
echo "$string"
}
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-right"
update_tmux_option "status-left"
}
main