-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathremote.tmux
executable file
·48 lines (39 loc) · 1.4 KB
/
remote.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
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/scripts/variables.sh"
source "$CURRENT_DIR/scripts/helpers.sh"
main() {
if option_not_set $toggle_key_option; then
tmux set-option -g $toggle_key_option $default_toggle_key
fi
if option_not_set $on_key_option; then
tmux set-option -g $on_key_option $default_on_key
fi
if option_not_set $off_key_option; then
tmux set-option -g $off_key_option $default_off_key
fi
local toggle_key=$(tmux show-option -gv "$toggle_key_option")
local on_key=$(tmux show-option -gv "$on_key_option")
local off_key=$(tmux show-option -gv "$off_key_option")
tmux unbind -T root $toggle_key
tmux unbind -T off $toggle_key
tmux unbind -T root $on_key
tmux unbind -T off $on_key
tmux unbind -T root $off_key
tmux unbind -T off $off_key
# Press the toggle key to toggle "remote mode"; disables host bindings for
# using tmux in nested sessions
tmux bind -T root $toggle_key \
run-shell "$CURRENT_DIR/scripts/toggle_on.sh"
tmux bind -T off $toggle_key \
run-shell "$CURRENT_DIR/scripts/toggle_off.sh"
tmux bind -T root $on_key \
run-shell "$CURRENT_DIR/scripts/toggle_on.sh"
tmux bind -T off $on_key \
run-shell "$CURRENT_DIR/scripts/toggle_on.sh"
tmux bind -T root $off_key \
run-shell "$CURRENT_DIR/scripts/toggle_off.sh"
tmux bind -T off $off_key \
run-shell "$CURRENT_DIR/scripts/toggle_off.sh"
}
main