Add attach option and shortcuts to tmux_pair
This commit is contained in:
parent
061283bac7
commit
6b501af1f9
|
@ -21,7 +21,7 @@ pushd ~
|
||||||
SOCKET_PATH="/var/tmux_share/shared"
|
SOCKET_PATH="/var/tmux_share/shared"
|
||||||
SHARED_USER="foxsoft" # Should change this to use getent group tmux
|
SHARED_USER="foxsoft" # Should change this to use getent group tmux
|
||||||
|
|
||||||
share_session() {
|
share_ro_session() {
|
||||||
chmod 770 $SOCKET_PATH
|
chmod 770 $SOCKET_PATH
|
||||||
chgrp tmux $SOCKET_PATH
|
chgrp tmux $SOCKET_PATH
|
||||||
tmux -S $SOCKET_PATH server-access -ar $SHARED_USER
|
tmux -S $SOCKET_PATH server-access -ar $SHARED_USER
|
||||||
|
@ -43,19 +43,25 @@ new_session() {
|
||||||
tmux -S $SOCKET_PATH attach
|
tmux -S $SOCKET_PATH attach
|
||||||
}
|
}
|
||||||
|
|
||||||
|
attach_to_session() {
|
||||||
|
tmux -S $SOCKET_PATH attach
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $# -eq 0 ]] ; then
|
if [[ $# -eq 0 ]] ; then
|
||||||
echo "No arguments given. Use -h for help."
|
echo "No arguments given. Use -h for help."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $1 = "new" ]] ; then
|
if [[ $1 = "new" || $1 = "n" ]] ; then
|
||||||
new_session
|
new_session
|
||||||
elif [[ $1 = "share" ]] ; then
|
elif [[ $1 = "sharero" || $1 = "sro" ]] ; then
|
||||||
share_session
|
share_session
|
||||||
elif [[ $1 = "sharew" ]] ; then
|
elif [[ $1 = "sharew" || $1 = "srw" ]] ; then
|
||||||
share_rw_session
|
share_rw_session
|
||||||
elif [[ $1 = "unshare" ]] ; then
|
elif [[ $1 = "unshare" ]] ; then
|
||||||
unshare_session
|
unshare_session
|
||||||
|
elif [[ $1 = "attach" || $1 = "a" ]] ; then
|
||||||
|
attach_to_session
|
||||||
else
|
else
|
||||||
echo "Unrecognised argument. Use -h for help."
|
echo "Unrecognised argument. Use -h for help."
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue