I had multiple Linux terminal windows open, doing SSH to different machines. I typed shutdown in the wrong window – and the wrong server shutdown!
I had configured different profiles so I could have a white background, a green background and a yellow background for my different systems, but I had got careless and not used them.
I found a neat way of colouring the windows automatically.
xdotool is a command-line X11 automation tool, which allows you to programmatically press keys. You can use this to set the profile of a terminal window.
To create a profile
From the hamburger options,
- preferences,
- profiles +
- give the profile a name, create
- select the named profile, it will display customising options
- colours
- untick Use colours from system theme
- Click Text or Background
- Pick a colour, Select
- Close the window
Select a profile
Manually
- From the hamburger option
- Select Profile
- Pick a profile
- or Shift+f10
- r (for Profile)
- 3 for the third option in the list
Programmatically
xdotool key shift+F10 r 3
This does Shift+10, then select r for Profile, then picks the 3rd option
The clever bit
You can make an alias such as
alias somehost="
xdotool key shift+F10 r 3
; ssh user@somehost;xdotool key shift+F10 r 2
"
or a somehost.sh script
#!/bin/sh
xdotool key shift+F10 r 3
ssh me@10.1.0.5
xdotool key shift+F10 r 2
If you enter the somehost command – it will select the 3rd profile, do the ssh. On exit from ssh it resets it back to the 2nd profile.