Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add ability to host/join foreign tmux sessions.

Created aliases to ease the creation and joining of multi-user tmux sessions.
tmux-host     : Create tmux session for other users to join.
tmux-kill-host: Kill tmux-server and remove /tmp/tmux_host session file.
tmux-mirror   : Attach to Host in read-only mode.
tmux-pair     : Create attachment to Host which allows editing.
tmux-attach   : Reattach to Pair Mode session (can only be run after tmux-pair).
All joining commands notify the tmux session that the user has connected.
  • Loading branch information...
commit 2e5a58d1fee90f8da319a9d609335e1a2e397f0b 1 parent e3f5b7b
Matt Furden authored
Showing with 10 additions and 8 deletions.
  1. +10 −8 tmux_host
18 tmux_host
View
@@ -1,16 +1,18 @@
-# # To only allow client to mirror and disconnect them if they detach:
-# exec tmux -S /tmp/tmux_host display-message "$USERNAME has connected in mirror mode." && tmux -S /tmp/tmux_host a -t Host -r
+# To only allow client to mirror and disconnect them if they detach:
+tmux -S /tmp/tmux_host display-message "`whoami` has connected in mirror mode."
+exec tmux -S /tmp/tmux_host a -t Host -r
+# Convenience aliases to make hosting and joining sessions less annoying.
+# Be sure to comment out tmux-host and tmux-kill-host for ssh clients.
alias tmux-host='tmux -S /tmp/tmux_host new-session -s Host -d && chmod 1777 /tmp/tmux_host && tmux-attach'
alias tmux-kill-host='tmux -S /tmp/tmux_host kill-server; rm /tmp/tmux_host'
-alias tmux-mirror='tmux -S /tmp/tmux_host display-message "$USERNAME has connected in mirror mode." && tmux -S /tmp/tmux_host a -t Host -r'
-alias tmux-pair='tmux -S /tmp/tmux_host display-message "$USERNAME has connected in pair mode." && tmux -S /tmp/tmux_host new-session -t Host -s Client'
-alias tmux-attach='tmux -S /tmp/tmux_host display-message "$USERNAME has reattached to pair mode." && tmux -S /tmp/tmux_host a'
+alias tmux-mirror='tmux -S /tmp/tmux_host display-message "`whoami` has connected in mirror mode." && tmux -S /tmp/tmux_host a -t Host -r'
+alias tmux-pair='tmux -S /tmp/tmux_host display-message "`whoami` has connected in pair mode." && tmux -S /tmp/tmux_host new-session -t Host -s Client'
+alias tmux-attach='tmux -S /tmp/tmux_host display-message "`whoami` has reattached to pair mode." && tmux -S /tmp/tmux_host a'
+# # To start client in mirror mode but allow them to detach:
+# tmux-mirror
# echo "To connect to tmux please use one of the following:"
# echo "tmux-mirror: Attach to Host in read-only mode"
# echo "tmux-pair : Create attachment to Host which allows editing"
# echo "tmux-attach: Reattach to Pair Mode session (can only be run after tmux-pair)"
-
-# # To start client in mirror mode but allow them to detach:
-# tmux-mirror
Please sign in to comment.
Something went wrong with that request. Please try again.