Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer 1

For finding windows you can use xdotool search like

WID=`xdotool search "Mozilla Firefox" | head -1`

xdotool behave looked like something you can use for second part, but unfortunately no maximize and minimize events there - also it works only with existing windows - but you can check for opened windows from time to time with cron.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.