Tilix: change color scheme based on the hostname of directory location

I would like to share one of my tweaks when using the Tilix terminal emulator: I use the command line a lot, and Tilix allows you to dynamically change the profile of your terminal window based on the machine you are connected to.

To make this work, you need to source this script on the machine you want to SSH in to: /usr/share/tilix/scripts/tilix_int.sh (on Ubuntu, but it is available on Tilix GitHub as well).

I source it in .bashrc:

# Tilix magic
. /usr/share/tilix/scripts/tilix_int.sh

Now you create a profile per machine you want a distinct color scheme for (I mainly focus on the background color), and you configure it to recognize the host you are on using automatic profile switching in the profile “Advanced” tab. I only use the host matching function, but it can match directories as well (I assume this can be handy when you are a professional that works on web servers, databases etc where location can be more critical as the actual host or container you are on).

I had a nice screenshot of this but it seems new users only can include one screenshot so I opted for the second one.

It is extremely convenient to immediately know what system you are logged on to in a terminal. Here you have Tilix connected to my laptop, desktop, and NAS. I noticed I tend to use full screen terminals more since switching them is far less confusing when you don’t loose track off what system you are actually on.

To replicate profiles and settings for Tilix across machines, you can use the following commands to dump or load the config settings:

dconf dump /com/gexperts/Tilix/ > tilix.dconf
dconf load /com/gexperts/Tilix/ < tilix.dconf

Tilix is looking for maintainers so I am slightly worried about it staying around… I am not aware of any other terminal emulator with this capability. I tried doing the same using tmux, but it does not offer the same feature (yet?). If you would know off an alternative that can do exactly this, let me know!


There’s theme.sh which makes it easy to change terminal themes on the fly. Works on any terminal with OSC 4/11 support which is almost every terminal. I use it with xfce4-terminal which is xterm based.

If you want a different theme per system with theme.sh the simple way would be to just add a one-liner to the .bashrc of each system, Ex:

echo "theme.sh tempus-autumn" >> ~/.bashrc

If you wanted to have it be directory specific or something else, you could do a bit of shell scripting in the .bashrc to make that happen (let me know if you need help).

1 Like

If forgot to thank you at the time, this has been very interesting and nice indeed! :slight_smile:


I just spent like an hour gussying up my VPS’. Much appreciated! :nerd_face:

I liked the following color schemes:

  • tomorrow-night-eighties
  • outrun-dark
  • medallion
1 Like

I too am a tilix fan. One nitpick about tilix: tilix insists on interfering with/controlling the background color. I couldn’t figure out how to get tilix to allow theme.sh to take over control of the background color.

Ubuntu’s default terminal, Gnome Terminal (as in, press Ctrl + Alt + T), doesn’t interfere with the background color in this way, so theme.sh looks better. But I don’t like Gnome Terminal’s tabs, rather preferring how Tilix allows more terminals tiled below within the same window, with that sweet “Add terminal down” button (this text shows when hovering over the button I’m referring to).