From 181688ef7cf7c608367e10d2438f9ca8dbf40921 Mon Sep 17 00:00:00 2001 From: yage Date: Mon, 24 Jul 2023 08:52:23 -0600 Subject: [PATCH] rename omni tmux session files; renumber windows for easier navigation --- scwrypts/ssh/{omni => omni/launcher} | 4 +-- scwrypts/ssh/{omni-manager => omni/manager} | 0 scwrypts/ssh/omni/spawn | 30 +++++++++++++++++++ .../ssh/{omni.tmux.conf => omni/tmux.conf} | 14 ++++++++- scwrypts/ssh/ssh.scwrypts.zsh | 7 ++++- 5 files changed, 51 insertions(+), 4 deletions(-) rename scwrypts/ssh/{omni => omni/launcher} (86%) rename scwrypts/ssh/{omni-manager => omni/manager} (100%) create mode 100755 scwrypts/ssh/omni/spawn rename scwrypts/ssh/{omni.tmux.conf => omni/tmux.conf} (79%) diff --git a/scwrypts/ssh/omni b/scwrypts/ssh/omni/launcher similarity index 86% rename from scwrypts/ssh/omni rename to scwrypts/ssh/omni/launcher index 6023693..d5aeae7 100755 --- a/scwrypts/ssh/omni +++ b/scwrypts/ssh/omni/launcher @@ -22,12 +22,12 @@ OMNI_TMUX list-sessions 2>/dev/null | grep -v omni-manager | grep -qi omni || { STATUS "initializing omni server" OMNI_TMUX kill-session -t=omni-manager >/dev/null 2>&1 - OMNI_TMUX -f "$SCWRYPTS_ROOT__remote/omni.tmux.conf" new -d -s omni \ + OMNI_TMUX -f "$SCWRYPTS_ROOT__remote/omni/tmux.conf" new -d -s omni \ "echo searching for first connection...; sleep 30" \; \ split-window "sleep 3; TMUX= tmux -L $OMNI_SOCKET a -t=omni-manager" \; \ move-window -t 99 \; - OMNI_TMUX new -d -s omni-manager "$SCWRYPTS_ROOT__remote/omni-manager" + OMNI_TMUX new -d -s omni-manager "$SCWRYPTS_ROOT__remote/omni/manager" } STATUS 'connecting to omni server' diff --git a/scwrypts/ssh/omni-manager b/scwrypts/ssh/omni/manager similarity index 100% rename from scwrypts/ssh/omni-manager rename to scwrypts/ssh/omni/manager diff --git a/scwrypts/ssh/omni/spawn b/scwrypts/ssh/omni/spawn new file mode 100755 index 0000000..89ce919 --- /dev/null +++ b/scwrypts/ssh/omni/spawn @@ -0,0 +1,30 @@ +#!/bin/zsh + +##################################################################### + +DEPENDENCIES+=() +REQUIRED_ENV+=() + +CHECK_ENVIRONMENT + +##################################################################### + +[[ $TERM =~ tmux ]] && FAIL 69 "\n Cannot run tmux-omni within a tmux session!\n " + +OMNI_SOCKET="omni.socket" +OMNI_TMUX() { tmux -L $OMNI_SOCKET $@; } + +OMNI_TMUX list-sessions 2>/dev/null | grep -v omni-manager | grep -qi omni || { + STATUS "initializing omni server" + OMNI_TMUX kill-session -t=omni-manager >/dev/null 2>&1 + + OMNI_TMUX -f "$SCWRYPTS_ROOT__remote/omni/tmux.conf" new -d -s omni \ + "echo searching for first connection...; sleep 30" \; \ + split-window "sleep 3; TMUX= tmux -L $OMNI_SOCKET a -t=omni-manager" \; \ + move-window -t 99 \; + + OMNI_TMUX new -d -s omni-manager "$SCWRYPTS_ROOT__remote/omni/manager" +} + +STATUS 'connecting to omni server' +OMNI_TMUX a -t=omni diff --git a/scwrypts/ssh/omni.tmux.conf b/scwrypts/ssh/omni/tmux.conf similarity index 79% rename from scwrypts/ssh/omni.tmux.conf rename to scwrypts/ssh/omni/tmux.conf index 061bed0..60a3e4f 100644 --- a/scwrypts/ssh/omni.tmux.conf +++ b/scwrypts/ssh/omni/tmux.conf @@ -40,9 +40,21 @@ bind-key -n M-w send-keys C-M-w unbind-key C-b bind-key C-b send-prefix -set-option -g prefix C-a +set-option -g prefix C-s # force reload now bind-key -n M-R send-keys -t omni-manager ENTER set -g status-right "omni host : #(hostnamectl --static) | #(cat /sys/class/power_supply/BAT0/capacity)% " + +set -g base-index 1 + +bind-key -n M-1 select-window -t 1 +bind-key -n M-2 select-window -t 2 +bind-key -n M-3 select-window -t 3 +bind-key -n M-4 select-window -t 4 +bind-key -n M-5 select-window -t 5 +bind-key -n M-6 select-window -t 6 +bind-key -n M-7 select-window -t 7 +bind-key -n M-8 select-window -t 8 +bind-key -n M-9 select-window -t 9 diff --git a/scwrypts/ssh/ssh.scwrypts.zsh b/scwrypts/ssh/ssh.scwrypts.zsh index bc2f643..5d25c73 100644 --- a/scwrypts/ssh/ssh.scwrypts.zsh +++ b/scwrypts/ssh/ssh.scwrypts.zsh @@ -25,12 +25,17 @@ SCWRYPTS__LIST_AVAILABLE_SCWRYPTS__remote() { done echo "$SCWRYPTS_TYPE__remote/tmux/omni" + echo "$SCWRYPTS_TYPE__remote/tmux/spawn" echo "$SCWRYPTS_TYPE__remote/remote/configure" } SCWRYPTS__GET_RUNSTRING__remote__$SCWRYPTS_TYPE__remote() { [[ $SCWRYPT_NAME =~ tmux/omni ]] \ - && echo "source $SCWRYPTS_ROOT__remote/omni" \ + && echo "source $SCWRYPTS_ROOT__remote/omni/launcher" \ + && return 0 + + [[ $SCWRYPT_NAME =~ tmux/spawn ]] \ + && echo "source $SCWRYPTS_ROOT__remote/omni/spawn" \ && return 0 [[ $SCWRYPT_NAME =~ remote/configure ]] \