2

I'm running Ubuntu 19.10. I have a few terminal profiles that have different colors (e.g. login, cluster, and admin). I would like it to automatically change the terminal profile to "login" when I start an SSH session to our login host, "cluster" when I ssh to our cluster, and "admin" when I go to our admin host.

Is it possible for the default Terminal to detect that I'm running something and change based on context?

If not, is is possible to change the profile by creating aliases like: loginssh='$CHANGE_TERMINAL_COMMAND --profile=login && ssh login clusterssh='$CHANGE_TERMINAL_COMMAND --profile=cluster && ssh cluster

I see that it's possible to do this via the PS1 in my .bashrc from here: Change terminal colour based on SSH session, but I'd rather switch the profile than muck about with that.

Aphoid
  • 177
  • 1
  • 1
  • 8
  • Is this something I can accomplish with gsettings? I don't want to change a specific value, I want to select an entirely different profile. I found an old solution using gconftool-2 here: https://stackoverflow.com/questions/660442/switch-gnome-terminal-profile-from-the-command-line – Aphoid Nov 07 '19 at 21:59
  • I also see that I can open up new windows/tabs by running `gnome-terminal --profile admin -- ssh admin` or the like, but I want to change the CURRENT window/tab, not open a new one. – Aphoid Nov 07 '19 at 22:07
  • The gconftool-2 (or gsettings, dconf) approach is conceptually broken, it changes the properties of _all_ the terminals using the given profile. – egmont Nov 08 '19 at 08:19
  • Search for OSC 4, 10, 11. They allow you to change the colors runtime. – egmont Nov 08 '19 at 08:19
  • I've filed https://gitlab.gnome.org/GNOME/gnome-terminal/issues/183 for this feature request. – egmont Nov 08 '19 at 08:28

0 Answers0