I'd like to add into my .bashrc a little script that sets the terminal background to transparent iff I don't have any non-minimised, non-terminal windows open and leaves the terminal background as image if there is something open.
I'm using 12.04 with Unity.
I've no problem setting the terminal background, but I've only got a kludge to tell if a program is open, and can't tell if the window is minimised.
My kludge at the moment:
if [ -z "$( ps -e | grep firefox )" ]
then
gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/background_type transparent
else
gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/background_type image
fi
(add inset for each of my most used programs)
I'd be happy with being able to tell at launch of terminal, but if I could turn the terminal transparent upon minimising (or closing) the last open window, that would be amazing. I'd guess something like:
export largewindows= #number of open, non-minimised windows
if [ $largewindows -eq 0 ]
then
gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/background_type transparent
fi
with (somehow) a little script that runs this upon opening, closing, minimising or un-minimising a program window.
What I don't know:
How to count the number of windows (or even running programs) automatically.
How to run a script every time I open/close/minimise/un-minimise a window.
Any advice in the right direction would be appreciated - Thanks a lot!