From 6b501af1f94b7a08448648264cac3a838c3a8373 Mon Sep 17 00:00:00 2001 From: Trevor Vallender Date: Wed, 15 Mar 2023 09:25:39 +0000 Subject: [PATCH] Add attach option and shortcuts to tmux_pair --- tmux_pair.bash | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tmux_pair.bash b/tmux_pair.bash index e5cadbe..ba50268 100755 --- a/tmux_pair.bash +++ b/tmux_pair.bash @@ -21,7 +21,7 @@ pushd ~ SOCKET_PATH="/var/tmux_share/shared" SHARED_USER="foxsoft" # Should change this to use getent group tmux -share_session() { +share_ro_session() { chmod 770 $SOCKET_PATH chgrp tmux $SOCKET_PATH tmux -S $SOCKET_PATH server-access -ar $SHARED_USER @@ -43,19 +43,25 @@ new_session() { tmux -S $SOCKET_PATH attach } +attach_to_session() { + tmux -S $SOCKET_PATH attach +} + if [[ $# -eq 0 ]] ; then echo "No arguments given. Use -h for help." exit fi -if [[ $1 = "new" ]] ; then +if [[ $1 = "new" || $1 = "n" ]] ; then new_session -elif [[ $1 = "share" ]] ; then +elif [[ $1 = "sharero" || $1 = "sro" ]] ; then share_session -elif [[ $1 = "sharew" ]] ; then +elif [[ $1 = "sharew" || $1 = "srw" ]] ; then share_rw_session elif [[ $1 = "unshare" ]] ; then unshare_session +elif [[ $1 = "attach" || $1 = "a" ]] ; then + attach_to_session else echo "Unrecognised argument. Use -h for help." fi