How do I stop Windows applications from stealing focus

Kev picture Kev · Aug 22, 2008 · Viewed 7.9k times · Source

I know this isn't strictly a programming question but y'all must have experienced this.

So...you have four or five RDP sessions open over the corp VPN, you're bashing away inside your favourite IDE, your VPN to the data centre bounces briefly then recovers, all your RDP sessions start re-establishing their connections and whilst doing so sequentially keep grabbing focus, one after the other. Pretty bloody annoying and downright rude.

Any idea how to prevent this behaviour and just make the RDP client flash it's taskbar button instead of totally grabbing focus away from whatever you were doing?

@Jason - thanks for the reply, I'm running 64 bit Vista and 64 Bit Windows 2008. Any ideas how well it plays?

@Jason - good idea. Done.

@Ryan - thanks also for the answer. I tried Terminals a few times before, but quite often I need to see two or three sessions side by side which the tabbing doesn't really facilitate too well, would've been nice to have a 'pop out in own window' button. I did once grab the source code to fix stuff like that, but never got the time. I also found it behaved oddly whenever there was a brief network disconnect (e.g. xDSL flapping) and it would reconnect to the wrong session (usually a new one) and leave the session I had opened in a disconnected state on the server. Otherwise Terminals would've been really cool, we have 200+ windows servers, and organising all those .rdp files can be a pain.

Answer

Jason Bunting picture Jason Bunting · Aug 22, 2008

I use Tweak UI to configure explorer so that apps don't steal focus; you can also configure how many times they flash in the taskbar as well.

EDIT: Once you are within Tweak UI, these options are found under General > Focus.

EDIT: @Kev, apparently there is a 64-bit version (not MS approved, apparently, I would scan it for viruses of course) that works successfully with the 64-bit version of XP. From what I understand, you download that and then run it in XP compatibility mode as administrator and it will do the trick. Tweak UI is basically a nice wrapper around a collection of registry hacks, so I imagine you could find the hacks themselves if you didn't care for running Tweak UI in this manner. Hope that works for you!