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