]> git.friedersdorff.com Git - max/dotfiles.git/blobdiff - bash/.bash_aliases
Combine various mail modes
[max/dotfiles.git] / bash / .bash_aliases
index de525676956ecfc4d5228ad5efc22f06add7a1de..d5cc9d5ca933872062bbcccab5a85f84f5a0cfe1 100644 (file)
@@ -24,3 +24,29 @@ alias tmux='TERM=xterm-256color tmux'
 if [ -x /usr/bin/gvim ]; then 
   alias vim='gvim -v'
 fi
+
+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 \
+    sh -c \
+    "ssh \
+      -o RemoteCommand=\"/bin/sh -c 'exec tmux -f ~/.tmux_ssh.conf new -As remote'\" \
+      -S \"$control_file\" \
+      -t \
+      \"$@\"
+    ssh -O exit -S \"$control_file\" \"$1\"" 
+}