4

I use terminator as a terminal, zsh shell and oh my zsh, on both my laptop and my server, for what it's worth, I created an alias named vps to connect to my vps using ssh.

Currently terminator background color is black, could it be made lets say white when connected to vps, although it's pretty easy to tell when I'm connected to the vps and when I'm not, still it would be nice if such thing is possible.

Radu Rădeanu
  • 166,822
  • 48
  • 327
  • 400
Lynob
  • 6,615
  • 16
  • 76
  • 108
  • I could do a completely different answer about changing the colour of the prompt (I use it otherwise I get confused between three machines with three terminals on different operating systems).... – Wilf Jul 13 '14 at 21:20
  • ignore previous comment, thats for bash so might not work in zsh... – Wilf Jul 13 '14 at 21:49
  • For bash, see [this answer](http://askubuntu.com/a/310552/147044). I suppose that something similar can be done in zsh as well - changing the `PS1` value. – Radu Rădeanu Jul 17 '14 at 07:50
  • @RaduRădeanu thanks I will try it but why do i have to change it on the hosting machine too? – Lynob Jul 17 '14 at 19:39
  • @Fischer If you will read [the answer](http://askubuntu.com/a/310552/147044), you will probably understand that yes, you have to change the value of `PS1` on both sides... – Radu Rădeanu Jul 17 '14 at 20:11

1 Answers1

2

One method is to use different profiles for the Terminator windows - for example, you could have this as the profile at ~/.config/terminator/config:

 # This is a comment
 [global_config]
   focus = system

 [keybindings]
   full_screen = <Ctrl><Shift>F11

 [profiles]
   [[default]]
     font = Fixed 10
     background_color = "#000000" # A comment
     foreground_color = "#FFFFFF" # Note that hex colour values must be quoted
     scrollback_lines = '500' #More comment. Single quotes are valid too
     cursor_blink = True
   [[ssh]]
     font = Fixed 10
     background_color = "#0000BB" # A comment
     foreground_color = "#FFFFFF" # Note that hex colour values must be quoted
     scrollback_lines = '500' #More comment. Single quotes are valid too
     cursor_blink = True
     #exit_action = restart #Stops the terminal from closing after the command has been run

Then you could open the terminator window, selecting the profile with:

terminator -p ssh

You could also run the command directly with the -e option - e.g.

terminator -p ssh -e "ssh vps"

For this you may want to uncomment the exit_action = restart line, so the terminal does not exit immediately after the command is run.

For more on how to edit make/edit Terminator profiles, run man terminator_config - you can easily change the background colour by editing the background_color line - you will need to quote it.

Wilf
  • 29,694
  • 16
  • 106
  • 164
  • nice try, few issues first, it doesn't work, it gives this error http://pastebin.com/e1FajEAm and should I always run `terminator -p ssh` or only 1 time? and another window opens, background blue, though you made it white – Lynob Jul 13 '14 at 21:58
  • You need to run every time you want a terminal with a different background (I think it uses the 'efault' entry by default, surprise surprise). The error you gave seems to be to you adding a custom key binding... `WARNING **: Binding 'a' failed! Unable to bind hide_window key, another instance/window has it.`... try an exact copy of the above profile (I based on the one off of the `man` page, then try adding modifications.) – Wilf Jul 13 '14 at 22:02
  • i backed up my config, copy past yours as is, still http://i.imgur.com/Pqtc2Ex.png and http://i.imgur.com/crDaWbs.png – Lynob Jul 13 '14 at 23:31