Prevent applications from stealing focus
Have you ever noticed that applications may steal the focus while you are working on your system? This can happen for a number of reasons, when you are extracting files for instance or transfers finish, or when an application displays a notification on the screen that is automatically pushed to the foreground.
Most of the time it is not really an issue, for instance when you are watching a video as it does not stop you from watching it. Sometimes however it happens when I'm typing, writing an article for Ghacks for instance and when that happens, some of the text that I'm writing is no longer added to the text editor or browser, but sent to the application that stole focus on the system.
When I realize that I have to click back on the window I was working on, re-read the last sentence or two to understand it, retype the words that were not recorded due to the focus issue, and continue writing from then on out.
The easiest way of preventing focus stealing is to use Tweak UI which has a setting that is called "Prevent applications from stealing focus". Checking this option prevents that other applications pop up suddenly and steal the focus of the window you are currently working in.
This only works when the application has been minimized before. Instead of stealing the focus it will flash a number of times which can be defined in the same menu in Tweak UI. If you do not want to use Tweak UI you can change the setting in the Windows Registry.
Press Windows-r to open up the runbox, enter regedit here and tap on the enter key. Navigate to the Registry key HKEY_CURRENT_USER > Control Panel > Desktop and change the ForegroundLockTimeout value to 30d40 (Hexadecimal) or 200000 (Decimal). The key ForeGroundFlashCount defines the amount of flashes of a window to alert the user where 0 means unlimited.
Update: Microsoft seems to have resolved the situation under Windows 7 apparently, where applications are less likely to steal focus.
Is there an “harder” way, like preventing focus steal by “You need to restart” dialogs, it realy sucks if you write an article and confirm the dialog with the spacebar. *grml*
Even after doing that, Firefox still steals focus.
For instance, when I’m on a chat, it pops up every time a get a message.
This does not work. Please stop joining others in flooding the internet with this garbage. It is stealing our focus while we try to look for a solution that actually works.