Copy the current tmux config to the remote server,
ssh in and start tmux
function ssh_in() {
+ control_file="$TMPDIR/${1}_ssh_in"
+ if [[ -e $control_file ]]; then
+ echo "Session is already open"
+ exit
+ fi
+
+ cat ~/.tmux.conf | ssh \
+ -M \
+ -S "$control_file" \
+ -o ControlPersist=yes \
+ "${1}" \
+ 'cat - > ~/.tmux_ssh.conf'
+
+
i3-sensible-terminal -e \
- ssh -o RemoteCommand="/bin/sh -c 'tmux has-session && exec tmux attach || exec tmux'" \
- -t "$@"
+ sh -c \
+ "ssh \
+ -o RemoteCommand=\"/bin/sh -c 'exec tmux -f ~/.tmux_ssh.conf'\" \
+ -S \"$control_file\" \
+ -t \
+ \"$@\"
+ ssh -O exit -S \"$control_file\" \"$1\""
}