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'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.

share|improve this question
add comment

3 Answers 3

up vote 8 down vote accepted

The setting is in CompizConfig > General > Focus & Raise Behavior as so documented. The Window Matching rules are quite important.

share|improve this answer
    
Thanks, that helps. That keeps what I type going to the correct window, but the firefox windows that are being opened are still being opened ON TOP of what I'm working on... even though they don't have focus. Also, IntelliJ still ignores the rule. –  Joel Oct 20 '10 at 15:24
    
What kind of test you are doing and what kind of new windows are opened? –  lovinglinux Oct 20 '10 at 22:20
    
@lovinglinux: sorry just noticed you asked. I'm running selenium tests so Firefox windows open. Also, I'm running JUnit tests with a debugger so when a breakpoint is hit IntelliJ decides to take focus to tell me about it. The Firefox focus issue was resolved by tweaking Compiz as stated in msw's post. IntelliJ, however, tends to ignore the Compiz setting. –  Joel Nov 16 '10 at 22:43
    
@Joel how did you setup it? What Focus Prevention Level are you using and how did you configure the "Focus Prevention Windows" matching rules? –  blueyed Jul 21 '12 at 18:11
    
@blueyed, sorry, but it's been so long and I've since switched computers and don't remember what the settings were. –  Joel Jul 22 '12 at 4:39
add comment

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...

share|improve this answer
add comment

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 to 4.

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.

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.