Add attach option and shortcuts to tmux_pair

This commit is contained in:
Trevor Vallender 2023-03-15 09:25:39 +00:00
parent 061283bac7
commit 6b501af1f9
1 changed files with 10 additions and 4 deletions

View File

@ -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