I'm using Maverick with Compiz enabled.
I've searched AskUbuntu and Google. AskUbuntu doesn't have anything on this topic and everything Google turns up is a couple years old.
I'm doing browser tests and my tests are constantly spawning new Firefox windows. The problem is, when the window is spawned it takes focus. This is incredibly annoying as I'm usually in the middle of typing somewhere else. This doesn't only happen with my tests, but is the most common example I run into. Sometimes my IDE decides it wants focus when something special happens (like when something is done compiling) and then later I'll find fragments of IM messages I've typed in my code. This is driving me crazy. I've looked in both Gnome settings and Compiz settings and can't find a way to prevent that from happening.
Does anyone know of a way to prevent an app from stealing focus when it is opened? I'd rather have the taskbar flash at me or something to get my attention.
The setting is in CompizConfig > General > Focus & Raise Behavior as so documented. The Window Matching rules are quite important.
This is not something you should configure globally. I.e. you don't really want no new windows to take focus: you want no test windows to take focus. To accomplish this, use the Compiz Window Rules plugin to prevent all "test" Firefox windows from taking focus.
You would need to write a rule to identify only "test" Firefox instances. If they all have a specific string in the title, that would work. Otherwise you could use
wmctrl
to set theWM_ICON_NAME
X property. (I don't know how to easily set X properties for Firefox .. if anyone else does, please chime in!)If you're working in one window most of the time you could right-click on the title bar and tell the window to be always on top... it's not a perfect solution, but you could shade the window when you're done, or minimize it then return to it...
You can change this setting in the
gconf-editor
also, in case you don't have CCSM installed. Navigate to/apps/compiz/general/screen0/options/focus_prevention_level
key and set its value to4
.For some people, 4 is too high. Eclipse users will find that various dialogs won't grab the keyboard focus correctly when this is set to 4, but will if set to 3.