Change Gnome terminal theme programmatically

This doesn't do what you asked for, but it probably does what you want.

You can modify your .bashrc (or equivalent shell init file) to set your prompt based on whether you're using ssh or not.

i.e. put something like:

if [ -n $SSH_TTY ]; then
     export PS1=`echo -en '\033[42m\w\$ '`;
fi;

at the end of your .bashrc file on the remote machine. the \033[42m is an ANSI Escape Code that changes the background colour to green.

This way, the background colour of your terminal will be green (or magenta, or cyan, or whatever) only when you're logged in to a remote machine.


You might want to checkout the options to gnome-terminal:

gnome-terminal --help

gives

 --window-with-profile=PROFILENAME

Wrap this in a shell script:

#!/bin/bash
gnome-terminal --window-with-profile=PROFILENAME

then do

ssh-term

If you want to change more, look into aterm and other terms. Also look into Devilspie which can do more dynamic changes based on things like window title (removing window decorations and so on).

http://burtonini.com/blog/computers/devilspie

Tags:

Linux

Bash