logoalt Hacker News

pixelpoetyesterday at 2:07 AM2 repliesview on HN

Windows itself isn't guilty of this in my experience (lifetime of use until Linux switch last year), but other apps like shitty Akamai. Some years ago a coworker wrote this blog post and a simple tool to find out which programs are doing it: https://forwardscattering.org/post/30


Replies

Someone1234yesterday at 3:00 AM

Windows is absolutely guilty of this, and it is trivial to reproduce.

Reproduction steps:

- Start a reply to this comment in your browser, type some example words.

- Create a BAT file with the following contents:

         @echo off
         timeout /t 15 /nobreak >nul       
         start notepad.exe         

  - Run the BAT file.   

  - Immediately switch back to the browser tab, and place your focus into the HN reply box. Type a word. 

  - Wait for notepad to open   

  - Continue typing. Your typing will go into Notepad and not the browser tab you had focused last.   
This occurs commonly and continuously on Windows, it is damn obnoxious. The OS should never ever change focus, it should however flash the window/taskbar, that is acceptable, but not shift my typing into whatever arbitrary program opened. This used to be fixable via "ForegroundLockTimeout" which is what classic TweakUI altered, but was killed in Vista.

If you're a Visual Studio user, it is a daily annoyance. You hit Start/Play, go about your work, and then suddenly some time later focus shifts out from under you.

show 1 reply
nottorpyesterday at 7:44 AM

Why does a window manager allow applications to steal focus?

Focus should change only in response to user commands.