Prevent applications from stealing focus - gHacks Tech News

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.

application focus

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.

Summary
Prevent applications from stealing focus
Article Name
Prevent applications from stealing focus
Description
Block applications from stealing focus while you are working on a PC running the Windows operating system.
Author
Advertisement

We need your help

Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.

If you like our content, and would like to help, please consider making a contribution:


Previous Post: «
Next Post: »

Comments

  1. Salz` said on March 15, 2009 at 12:50 pm
    Reply

    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*

  2. Fak said on December 9, 2009 at 10:53 pm
    Reply

    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.

  3. a said on May 10, 2010 at 1:45 am
    Reply

    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.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

Please note that your comment may not appear immediately after you post it.