I was wondering if anyone would know how to change the background image in the terminal in a unique way.
I know how to change it so that every instance of the terminal has the same background, but I occasionally end up using 2 or 3 terminals to work in different paths.
I was wondering if there is a way to set some like
- Terminal 1: Image 1
- Terminal 2: Image 2
- Terminal 3: Image 3
- …
- Terminal N: Image N
EDIT
I was hoping to do this by developing a technique that would look through an assortment of profiles, previously defined by me, and each time I opened a terminal it would cycle through the next profile until it reaches the end and then it restarts. I am not sure what the best approach would be to this. Maybe an addition to ~/.bash_aliases
that defines the profiles and sets the terminal to change depending on the amount of times a terminal has been opened in that session.
Best Answer
What will you need ? xdotool (
sudo apt-get install xdotool
) and couple different profiles. I have 8 different profiles in my gnome-terminal , all with different colors or background settings. Make sure you have the menu bar (File, Edit, etc.) enabled. Otherwise - won't workThe command
xdotool key alt+f b $( expr $RANDOM % 8 )
Explanation: we get a random number $RANDOM as generated by the shell, get it's modulus (remainder) out of division by maximum number of profiles you have, and let
xdotool
execute sequence of keyboard shortcuts that correspond to dropping downFile
(alt+f) menu, selectingopen new tab
(b), and selecting profile with corresponding numberYou can turn this command into an alias (
alias newtab='xdotool key alt+f b $( expr $RANDOM % 8 )'
) or scriptI've taken that very same alias and placed it into my
.mkshrc
file (because I use mksh, not bash, so for you it's .bashrc). Here it is in actionUpdate | April 22, 2015
Here's a script to open a terminal window with your desired profile (and for each profile you can specify your own colors and background picture). Bind it to a keyboard shortcut through System Settings -> Keyboard -> Shortcuts -> Custom. For the command add full path to script
The script