adjusted README
This commit is contained in:
parent
3c9251678e
commit
48d7329c15
30
README.md
30
README.md
@ -1,4 +1,4 @@
|
||||
SSH.sh is a small wrapper script around ssh to open a ssh connection in tmux.
|
||||
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
|
||||
@ -7,32 +7,40 @@ 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".
|
||||
Additionally a map file can be configured which stores styles for tmux panes
|
||||
matched by patterns - like in ssh_config the first count matches. This makes
|
||||
it easier to see which pane has a ssh connection to which host when e.g. the
|
||||
hostnames are the same but from different subdomains.
|
||||
|
||||
Simply place ssh.sh, ssh.conf and ssh.map into the same directory. It should
|
||||
not interfere with existing configs because it starts an own server at an own
|
||||
socket with an own session. For testing simply run "sh 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:
|
||||
```
|
||||
alias ssh="sh ~/.tmux/SSH.sh -c"
|
||||
alias ssh="sh ~/.tmux/ssh.sh -c"
|
||||
```
|
||||
I wrote and tested this under OpenBSD's ksh. I guess bash should work too but
|
||||
I wrote and tested this with 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
|
||||
following to Your .cwmrc:
|
||||
script can also be used with cwm's wonderful "ssh to" dialog by placing the
|
||||
following into your .cwmrc:
|
||||
```
|
||||
command term 'ksh -c ". ~/.tmux/SSH.sh -c $1"'
|
||||
command term 'sh -c ". ~/.tmux/ssh.sh -c $1"'
|
||||
bind CM-Return xterm
|
||||
|
||||
# ...to launch the server only with one window with default shell
|
||||
bind CM-s 'ksh -c ". ~/.tmux/SSH.sh -c"'
|
||||
bind CM-s 'sh -c ". ~/.tmux/ssh.sh -c"'
|
||||
|
||||
# ...and if autogroup is preferred
|
||||
autogroup 1 "SSH,XTerm"
|
||||
|
||||
# ...or if you want prefer to use rofi place this into the config
|
||||
ssh-command: "sh ~/.tmux/ssh.sh -c {host}";
|
||||
```
|
||||
If You have xdotool installed it also focusses the xterm which is attached to
|
||||
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
|
||||
|
4
ssh.sh
4
ssh.sh
@ -19,7 +19,7 @@ _sock=${_sock##*/}
|
||||
_sock=${_sock%%.*}
|
||||
_ssh_config=${_path}/${_sock}.conf
|
||||
_style_map=${_path}/${_sock}.map
|
||||
_sess=${_sock}
|
||||
_sess="SSH"
|
||||
_tabw="15" # width of the tabs created
|
||||
|
||||
# run tmux with some defaults like utf-8 support and at an separate socket
|
||||
@ -197,7 +197,7 @@ case "$_opt" in
|
||||
;;
|
||||
|
||||
r)
|
||||
_setpane
|
||||
_setpane $OPTARG $@
|
||||
;;
|
||||
|
||||
*) usage
|
||||
|
Loading…
Reference in New Issue
Block a user