Compare commits
15 commits
a5a069f8d3
...
3352880bbe
Author | SHA1 | Date | |
---|---|---|---|
3352880bbe | |||
66af2d5373 | |||
7d324e6138 | |||
063ece9015 | |||
82e69fab3e | |||
0e640b88f9 | |||
eba8fa52b1 | |||
029034d687 | |||
caa762b137 | |||
b96c804717 | |||
a4f13e49a2 | |||
4bea7c24e7 | |||
fcf460d94e | |||
1964c4b172 | |||
b400c85174 |
2 changed files with 48 additions and 17 deletions
|
@ -113,5 +113,7 @@ Two interpreted languages for flexibility.
|
|||
* apt
|
||||
* apt-file search | grep
|
||||
* ffmpeg
|
||||
* tmux
|
||||
* get unresolved path for new panes & windows
|
||||
|
||||
### 6.2 [Further tasks](#when) {#when-further}
|
||||
|
|
63
sh/tmux.sh
63
sh/tmux.sh
|
@ -45,6 +45,34 @@ rwx_tmux_servers() {
|
|||
IFS=\"\${ifs}\"
|
||||
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 -g status \"\${current}\"
|
||||
}
|
||||
rwx_tmux_uptime() {
|
||||
local since=\"\$(uptime --since)\"
|
||||
local date=\"\$(echo \"\${since}\" | awk '{print \$1}')\"
|
||||
|
@ -106,12 +134,16 @@ set-option -g set-titles on
|
|||
# set title to working directory
|
||||
set-option -g set-titles-string '\
|
||||
#(sh -c \". ${script}; rwx_tmux_server\")\
|
||||
→ \
|
||||
/ \
|
||||
#{session_name}\
|
||||
→ \
|
||||
#{window_name} (#{window_index}∕#{session_windows})\
|
||||
→ \
|
||||
#{pane_current_command} (#{pane_index}∕#{window_panes})\
|
||||
/ \
|
||||
#{window_name}\
|
||||
/ \
|
||||
#{pane_current_command}\
|
||||
- \
|
||||
#{window_width} × #{window_height}\
|
||||
/ \
|
||||
#{pane_width} × #{pane_height}\
|
||||
'
|
||||
|
||||
# ╭────────┬──────╮
|
||||
|
@ -155,6 +187,7 @@ set-option -g status-format[0] '\
|
|||
#[fg=default]\
|
||||
#[bg=default] \
|
||||
} \
|
||||
\
|
||||
#[align=right]\
|
||||
#[fg=yellow]\
|
||||
#[bg=##181818] \
|
||||
|
@ -179,6 +212,7 @@ set-option -g status-format[1] '\
|
|||
#[fg=default]\
|
||||
#[bg=default] \
|
||||
} \
|
||||
\
|
||||
#[align=right]\
|
||||
#(sh -c \". ${script}; rwx_tmux_servers\")\
|
||||
'
|
||||
|
@ -188,11 +222,8 @@ set-option -g status-format[2] '\
|
|||
#[fg=cyan]#{pane_current_path}\
|
||||
#[fg=default]\
|
||||
#[bg=default] \
|
||||
\
|
||||
#[align=right]\
|
||||
#[fg=yellow]\
|
||||
#[bg=##181818] \
|
||||
#[bg=##282828]#{session_name}\
|
||||
#[bg=##181818] \
|
||||
'
|
||||
|
||||
# line 4
|
||||
|
@ -205,6 +236,7 @@ set-option -g status-format[3] '\
|
|||
#[fg=default]\
|
||||
#[bg=default] \
|
||||
} \
|
||||
\
|
||||
#[align=right]\
|
||||
#(sh -c \". ${script}; rwx_tmux_uptime\")\
|
||||
'
|
||||
|
@ -219,12 +251,7 @@ set-option -g status-format[4] '\
|
|||
#[fg=default]\
|
||||
#[bg=default] \
|
||||
} \
|
||||
#[fg=green]\
|
||||
#[bg=##181818] \
|
||||
#[bg=##282828]#{window_width}×#{window_height}\
|
||||
#[bg=##181818] \
|
||||
#[fg=default]\
|
||||
#[bg=default] \
|
||||
\
|
||||
#[align=right]\
|
||||
#{?uid,#[fg=green],#[fg=red]}\
|
||||
#[bg=##181818] \
|
||||
|
@ -268,6 +295,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-F4 set-option -g status 4
|
||||
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
|
||||
bind-key -n M-Down switch-client -n
|
||||
|
@ -286,8 +315,8 @@ bind-key C-s command-prompt { rename-session '%%' }
|
|||
bind-key C-w command-prompt { rename-window '%%' }
|
||||
|
||||
# split window
|
||||
bind-key h split-window -h
|
||||
bind-key v split-window -v
|
||||
bind-key h split-window -c '#{pane_current_path}' -h
|
||||
bind-key v split-window -c '#{pane_current_path}' -v
|
||||
|
||||
# kill server
|
||||
bind-key k kill-server
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue