-
Notifications
You must be signed in to change notification settings - Fork 2
/
playerctl.tmux
executable file
·46 lines (34 loc) · 1.36 KB
/
playerctl.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
#!/usr/bin/env bash
CWD="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$CWD/scripts/helpers.sh"
playerctl_short="#($CWD/scripts/playerctl_short.sh)"
playerctl_short_interpolation="\#{playerctl_short}"
playerctl_full="#($CWD/scripts/playerctl_full.sh)"
playerctl_full_interpolation="\#{playerctl_full}"
playerctl_title="#($CWD/scripts/playerctl_title.sh)"
playerctl_title_interpolation="\#{playerctl_title}"
playerctl_artist="#($CWD/scripts/playerctl_artist.sh)"
playerctl_artist_interpolation="\#{playerctl_artist}"
playerctl_album="#($CWD/scripts/playerctl_album.sh)"
playerctl_album_interpolation="\#{playerctl_album}"
do_interpolation() {
local string=$1
local string=${string/$playerctl_short_interpolation/$playerctl_short}
local string=${string/$playerctl_full_interpolation/$playerctl_full}
local string=${string/$playerctl_title_interpolation/$playerctl_title}
local string=${string/$playerctl_artist_interpolation/$playerctl_artist}
local string=${string/$playerctl_album_interpolation/$playerctl_album}
echo "$string"
}
update_tmux_option() {
local option="$1"
local option_value, new_option_value
option_value="$(get_tmux_option "$option")"
new_option_value="$(do_interpolation "$option_value")"
tmux set-option -gq "$option" "$new_option_value"
}
main() {
update_tmux_option "status-right"
update_tmux_option "status-left"
}
main