-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmouse
More file actions
executable file
·49 lines (44 loc) · 1.3 KB
/
tmouse
File metadata and controls
executable file
·49 lines (44 loc) · 1.3 KB
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
#!/bin/bash -
#===============================================================================
#
# FILE: tmouse
#
# USAGE: ./tmouse [on|off]
#
# DESCRIPTION: switch mouse on/off in current tmux session
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: modifying tm_options array may be necessary depend on tmux ver.
# AUTHOR: Marek Płonka (marekpl), marek.plonka@nask.pl
# ORGANIZATION: NASK
# CREATED: 22.09.2016 13:01:38
# REVISION: ---
#===============================================================================
set -o nounset # Treat unset variables as an error
set -e
tm_options=('mouse-select-pane' 'mouse-resize-pane' 'mouse-select-window')
switch_mouse() {
tm_state=$(tmux show-option -qv $option)
if [ -v $tm_state ]; then
tmux set -q $option on
else
case $tm_state in
on) tmux set -q $option off ;;
off) tmux set -q $option on ;;
*) echo "can not happen .." ;;
esac # --- end of case ---
fi
}
for option in ${tm_options[@]}; do
if [ $# -ge 1 ]; then
case $1 in
on|off) tmux set $option $1 ;;
*) switch_mouse ;;
esac
else
switch_mouse
fi
done
unset -f switch_mouse