This completely replaces what I was trying to do almost a decade ago.
Back then, I was mostly trying to use tmux as a TUI, but that doesn't fit my workflow now.
This does. I use xterm for terminals with ssh, but often have multiple windows open. This will color them and change the icon on the taskbar, etc. It's nothing fancy, but it's better than what was here, so if you find it, you're at least looking at something useful.
sshm.sh is a thin wrapper around ssh.
It accepts normal ssh arguments, checks the destination host against
sshm.config, and when there is a match it launches the session inside an
xterm with a configured icon and colors. When there is no match, it runs
plain ssh.
bashsshxtermxseticonfor window icon decoration
./sshm.sh [ssh arguments...]
./sshm.sh --helpExamples:
./sshm.sh dibbler
./sshm.sh user@dibbler
./sshm.sh -p 2222 user@example.com
./sshm.sh -J jumpbox internal-hostsshm.shaccepts the same argument forms thatsshdoes.- The first non-option destination is used to determine whether the host is in
sshm.config. - A config block matches when that destination equals either a
HostorHostNamevalue in the block. - If the matched host appears in a config block,
sshm.shlaunchesxtermand runssshinside it with the original argument list unchanged. - If the host is not in
sshm.config,sshm.shexecutes plainssh. - Matching
xtermsessions are launched withTERM=xterm-256color.
The default config file is sshm.config in the script directory.
Blocks are separated by comment lines beginning with #.
Supported keys:
Host: host alias or hostname to match. You can repeat this key within a block.HostName: alternate hostname or address to match.Icon: icon filename stem, icon filename, or absolute path.BGColor: xterm color name,#RRGGBB, or a0-255xterm palette index.FGColor: xterm color name,#RRGGBB, or a0-255xterm palette index.
Example:
########################################################################
Host dibbler
Host 192.168.1.101
Host stevesaus.me
Icon dibbler
BGColor 52
FGColor White
########################################################################
By default, icons are loaded from share/icons in the script directory.
Icon resolution order:
- exact path from
Icon $SSHM_ICON_DIR/<Icon>$SSHM_ICON_DIR/<Icon>.png
If an Icon value is configured but no file is found, sshm.sh prints a
warning to stderr and still launches the xterm.
SSHM_CONFIG: override the config file pathSSHM_ICON_DIR: override the icon directory
- Numeric
BGColorandFGColorvalues are interpreted as xterm 256-color palette indexes and converted to RGB before being passed toxterm. - Named colors are passed through directly to
xterm. - Whether remote applications use 256 colors still depends on the remote host's terminfo and application behavior.