From b96c8047170bf0ca2fad726ca1171cedda1d75e0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 2 Jul 2025 01:07:24 +0200 Subject: [PATCH] tmux/status --- sh/tmux.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/sh/tmux.sh b/sh/tmux.sh index 6b58047..663776f 100644 --- a/sh/tmux.sh +++ b/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 status \"\${current}\" +} rwx_tmux_uptime() { local since=\"\$(uptime --since)\" 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-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