2016-08-28 20:27:02 +02:00
|
|
|
SSH.sh is a small wrapper script around ssh to open a ssh connection in tmux.
|
|
|
|
|
|
|
|
The main purpose of this script is to configure the tmux windows titles with
|
|
|
|
the hostnames provided by the ssh command line itself. I have often to connect
|
|
|
|
to cloud hosts with crude hostnames I can't remember and therefore I prefer to
|
|
|
|
use cnames or hostnames set via .ssh/config - and exactly these names should
|
|
|
|
be used for window names in tmux and not set via escape sequences (pane
|
|
|
|
titles) from within the target hosts to their crude names.
|
|
|
|
|
|
|
|
Simply place SSH.sh and SSH.conf in ~/.tmux directory. It should not interfere
|
|
|
|
with existing configs because it starts an own server at an own socket with an
|
|
|
|
own session. For simple testing simply run "sh ~/.tmux/SSH.sh -c targethost".
|
|
|
|
Without arguments it starts a session without ssh and attaches a xterm to it.
|
|
|
|
|
|
|
|
It can be configured via a shell alias like this:
|
2016-08-29 04:46:15 +02:00
|
|
|
```
|
2016-08-28 20:27:02 +02:00
|
|
|
alias ssh="sh ~/.tmux/SSH.sh -c"
|
2016-08-29 04:46:15 +02:00
|
|
|
```
|
2016-08-28 20:27:02 +02:00
|
|
|
I wrote and tested this under OpenBSD's ksh. I guess bash should work too but
|
|
|
|
not tested yet.
|
|
|
|
|
|
|
|
As a lucky OpenBSD user I also use cwm as my preferred window manager. This
|
|
|
|
script can be used with cwm's wonderful "ssh to" dialog too by placing the
|
2016-08-29 04:46:15 +02:00
|
|
|
following to Your .cwmrc:
|
|
|
|
```
|
2016-08-28 20:39:33 +02:00
|
|
|
command term 'ksh -c ". ~/.tmux/SSH.sh -c $1"'
|
|
|
|
bind CM-Return xterm
|
|
|
|
|
2016-08-30 00:00:31 +02:00
|
|
|
# ...to launch the server only with on window
|
|
|
|
bind CM-s 'ksh -c ". ~/.tmux/SSH.sh -c"'
|
|
|
|
|
2016-08-29 04:46:15 +02:00
|
|
|
# ...and if autogroup is preferred
|
2016-08-28 20:39:33 +02:00
|
|
|
autogroup 1 "SSH,XTerm"
|
2016-08-29 04:46:15 +02:00
|
|
|
```
|
2016-08-28 20:27:02 +02:00
|
|
|
If You have xdotool installed it also focusses the xterm which is attached to
|
|
|
|
the session or spawns a new term and reattaches to an existing session.
|
|
|
|
|
|
|
|
Special thanks go to the OpenBSD developers for providing such a high quality
|
|
|
|
and stable operating system and to Nicholas Marriot for tmux - a tool I can't
|
|
|
|
work without it and his patience to answer my questions.
|
|
|
|
|
|
|
|
Enjoy.
|
2016-08-29 06:55:13 +02:00
|
|
|
|
|
|
|
With my sample config it looks then like this:
|
|
|
|
|
|
|
|

|