-
Notifications
You must be signed in to change notification settings - Fork 2
/
pacmux.tmux
executable file
·47 lines (41 loc) · 1.21 KB
/
pacmux.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
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/scripts/helpers.sh"
_interpolation=(
"\#{pacmux_overview}"
"\#{pacmux_sessions}"
"\#{pacmux_window_flag}"
"\#{pacmux_pacman}"
)
_commands=(
"#($CURRENT_DIR/scripts/pacmux_overview.sh #{session_alerts} #{window_id})"
"#($CURRENT_DIR/scripts/pacmux_sessions.sh #{session_id})"
"$(window_flag)"
"$(pacman)"
)
do_interpolation() {
local all_interpolated="$1"
for ((i=0; i<${#_commands[@]}; i++)); do
all_interpolated=${all_interpolated//${_interpolation[$i]}/${_commands[$i]}}
done
echo "$all_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"
}
update_tmux_window_option() {
local option=$1
local option_value=$(get_tmux_window_option "$option")
local new_option_value=$(do_interpolation "$option_value")
set_tmux_window_option "$option" "$new_option_value"
}
main() {
update_tmux_option "status-right"
update_tmux_option "status-left"
update_tmux_window_option "window-status-format"
update_tmux_window_option "window-status-current-format"
}
main