hi! Try this:
#!/bin/bash
delay=0.5
while true; do
windowId=`xdotool getwindowfocus`
xdotool getwindowname $windowId
xdotool windowactivate $windowId;
sleep $delay;
done
This script depends on you setting the "Focus prevention level" high enough so that new opened windows wont get the focus. It works on Ubuntu 10.04 and 12.04 at least, but should work anywhere... if it fails for you, say so and we can think together!
This is an endless loop (break it with ctrl+c) that will "activate" the window that has focus (focus for keyboard input). So it will make the focused window "jump" to foreground each 0.5 seconds (you can lower or up the delay value to your needs/taste).
So all new opened applications and windows will still open in the foreground but will be promptly hidden by the window that has focus!
Just to make it clear, they will not open in the background but this script will provide almost the same effect. Almost because if you are very unlucky you can still click on the new opened window before the focused one be put to foreground, what will make the new window be the focused one... Lowering the delay will help prevent that but consume more cpu, I think less than 0.1 is not good, but you must test to see what works better for you...
PS.: your xdotool version must support these commands: getwindowfocus, getwindowname, windowactivate
1Did you get a chance to try this yet? – imoatama – 2010-09-14T00:38:52.233
@imoatama It pops up an ugly terminal when run, but nonetheless does make the thing open in the background. – digitxp – 2010-09-14T03:25:18.353
I don't have the time to do that to every menu entry though. – digitxp – 2010-09-14T03:25:36.997
Just setting it to strict wasn't enough? Ie if you don't start things via terminal they steal focus? – imoatama – 2010-09-14T14:03:43.977
See edited answer for a simpler workaround. – imoatama – 2010-09-14T14:22:56.647
Your workaround worked. In 2 release cycles I'll probably be installing Jolicloud anyway. Thanks. – digitxp – 2010-09-16T11:31:59.153