This commit is contained in:
parent
a4f13e49a2
commit
b96c804717
1 changed files with 30 additions and 0 deletions
30
sh/tmux.sh
30
sh/tmux.sh
|
@ -45,6 +45,34 @@ rwx_tmux_servers() {
|
||||||
IFS=\"\${ifs}\"
|
IFS=\"\${ifs}\"
|
||||||
echo \"\${text}\"
|
echo \"\${text}\"
|
||||||
}
|
}
|
||||||
|
rwx_tmux_status() {
|
||||||
|
local current=\"\${1}\"
|
||||||
|
local operand=\"\${2}\"
|
||||||
|
case \"\${operand}\" in
|
||||||
|
\"+\")
|
||||||
|
case \"\${current}\" in
|
||||||
|
\"off\") current=\"on\" ;;
|
||||||
|
\"on\") current=\"2\" ;;
|
||||||
|
\"2\") current=\"3\" ;;
|
||||||
|
\"3\") current=\"4\" ;;
|
||||||
|
\"4\") current=\"5\" ;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
\"-\")
|
||||||
|
case \"\${current}\" in
|
||||||
|
\"on\") current=\"off\" ;;
|
||||||
|
\"2\") current=\"on\" ;;
|
||||||
|
\"3\") current=\"2\" ;;
|
||||||
|
\"4\") current=\"3\" ;;
|
||||||
|
\"5\") current=\"4\" ;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*) ;;
|
||||||
|
esac
|
||||||
|
tmux set-option status \"\${current}\"
|
||||||
|
}
|
||||||
rwx_tmux_uptime() {
|
rwx_tmux_uptime() {
|
||||||
local since=\"\$(uptime --since)\"
|
local since=\"\$(uptime --since)\"
|
||||||
local date=\"\$(echo \"\${since}\" | awk '{print \$1}')\"
|
local date=\"\$(echo \"\${since}\" | awk '{print \$1}')\"
|
||||||
|
@ -275,6 +303,8 @@ bind-key -n C-F2 set-option -g status 2
|
||||||
bind-key -n C-F3 set-option -g status 3
|
bind-key -n C-F3 set-option -g status 3
|
||||||
bind-key -n C-F4 set-option -g status 4
|
bind-key -n C-F4 set-option -g status 4
|
||||||
bind-key -n C-F5 set-option -g status 5
|
bind-key -n C-F5 set-option -g status 5
|
||||||
|
bind-key -n M-NPage run-shell '. ${script}; rwx_tmux_status #{status} -'
|
||||||
|
bind-key -n M-PPage run-shell '. ${script}; rwx_tmux_status #{status} +'
|
||||||
|
|
||||||
# switch session
|
# switch session
|
||||||
bind-key -n M-Down switch-client -n
|
bind-key -n M-Down switch-client -n
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue