diff --git a/sh/tmux.sh b/sh/tmux.sh index 8c5770a..a437b23 100644 --- a/sh/tmux.sh +++ b/sh/tmux.sh @@ -27,19 +27,41 @@ rwx_tmux_servers() { \" for path in \${paths}; do name=\"\$(basename \"\${path}\")\" + text=\"\${text}\\ +#[fg=default]\\ +#[bg=default] \\ +\" if [ \"\${active}\" = \"\${name}\" ]; then text=\"\${text}#[fg=green]\" else text=\"\${text}#[fg=yellow]\" fi text=\"\${text}\\ -#[bg=##181818] #[bg=##282828]\\ -\${name}\\ -#[bg=##181818] #[bg=default]#[fg=default] \" +#[bg=##181818] \\ +#[bg=##282828]\${name}\\ +#[bg=##181818] \\ +\" done IFS=\"\${ifs}\" echo \"\${text}\" } +rwx_tmux_uptime() { + local since=\"\$(uptime --since)\" + local date=\"\$(echo \"\${since}\" | awk '{print \$1}')\" + local time=\"\$(echo \"\${since}\" | awk '{print \$2}')\" + echo \"\\ +#[fg=yellow]\\ +#[bg=##181818] \\ +#[bg=##282828]\${date}\\ +#[bg=##181818] \\ +#[fg=default]\\ +#[bg=default] \\ +#[fg=yellow]\\ +#[bg=##181818] \\ +#[bg=##282828]\${time}\\ +#[bg=##181818] \\ +\" +} " rwx_file_write "${file}" "\ # ╭────────╮ @@ -84,12 +106,12 @@ 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} (#{window_index}∕#{session_windows})\ + → \ +#{pane_current_command} (#{pane_index}∕#{window_panes})\ ' # ╭────────┬──────╮ @@ -132,10 +154,16 @@ set-option -g status-format[0] '\ #[bg=##181818]#{?window_zoomed_flag,#[fg=magenta]], }\ #[fg=default]\ #[bg=default] \ -}\ +} \ #[align=right]\ #[fg=yellow]\ #[bg=##181818] \ +#[bg=##282828]%Y-%m-%d\ +#[bg=##181818] \ +#[fg=default]\ +#[bg=default] \ +#[fg=yellow]\ +#[bg=##181818] \ #[bg=##282828]%H:%M:%S\ #[bg=##181818]#{?client_prefix,#[fg=green]p, }\ ' @@ -143,32 +171,28 @@ set-option -g status-format[0] '\ # line 2 set-option -g status-format[1] '\ #{S:\ -#{?session_many_attached,#[fg=magenta],\ -#{?session_attached,#[fg=red],#[fg=yellow]}}\ +#{?session_many_attached,#[fg=red],\ +#{?session_attached,#[fg=green],#[fg=yellow]}}\ #[bg=##181818] \ #[bg=##282828]#{session_name}\ #[bg=##181818] \ #[fg=default]\ #[bg=default] \ -}\ -#[fg=white]→\ -#[fg=default] \ -#[fg=green]\ -#[bg=##181818] \ -#[bg=##282828]#{session_name}\ -#[bg=##181818] \ +} \ #[align=right]\ -#[fg=yellow]\ -#[bg=##181818] \ -#[bg=##282828]%Y-%m-%d\ -#[bg=##181818] \ +#(sh -c \". ${script}; rwx_tmux_servers\")\ ' # line 3 set-option -g status-format[2] '\ -#[fg=yellow]\ -#(sh -c \". ${script}; rwx_tmux_servers\")\ #[fg=cyan]#{pane_current_path}\ +#[fg=default]\ +#[bg=default] \ +#[align=right]\ +#[fg=yellow]\ +#[bg=##181818] \ +#[bg=##282828]#{session_name}\ +#[bg=##181818] \ ' # line 4 @@ -180,12 +204,9 @@ set-option -g status-format[3] '\ #[bg=##181818] \ #[fg=default]\ #[bg=default] \ -}\ +} \ #[align=right]\ -#[fg=yellow]\ -#[bg=##181818] \ -#[bg=##282828]#{host}\ -#[bg=##181818] \ +#(sh -c \". ${script}; rwx_tmux_uptime\")\ ' # line 5 @@ -197,18 +218,24 @@ set-option -g status-format[4] '\ #[bg=##181818] \ #[fg=default]\ #[bg=default] \ -}\ -#[fg=white]=\ -#[fg=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] \ #[bg=##282828]#{user}\ #[bg=##181818] \ +#[fg=default]\ +#[bg=default] \ +#[fg=yellow]\ +#[bg=##181818] \ +#[bg=##282828]#{host}\ +#[bg=##181818] \ ' # refresh period