Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop Windows applications from stealing focus [closed]

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.

like image 717
Kev Avatar asked Aug 22 '08 17:08

Kev


3 Answers

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!

like image 146
Jason Bunting Avatar answered Nov 14 '22 08:11

Jason Bunting


As an alternative, you could try using something like Terminals. It allows you to have multiple remote desktop windows open at once all as tabs in the same window. Quite cool. Also, it is open source so you can change its behavior if needed (although I don't believe it steals focus like a normal RDP session does).

Terminals Screenshot

like image 22
Ryan Farley Avatar answered Nov 14 '22 10:11

Ryan Farley


Since I don't think there's an approved version of TweakUI other than for XP. Apparently making this change in the registry has a similar impact for Vista:

[HKEY_CURRENT_USER\ControlPanel\Desktop]

ForegroundLockTimeout = 0

However I found (Vista x64) that while focus on the original was maintained the offending window would still take the foreground - quite distracting.

like image 2
waldo Avatar answered Nov 14 '22 09:11

waldo