Comment by technofiend

1 month ago

I've been beefing about this for decades; X Window didn't do this by default and you could adjust window manager behavior however you liked to prevent windows stealing focus in X, even for newly realized windows. Microsoft Windows decided for some reason the newest window gets focus, which is annoying as heck. I really don't want my attention involuntarily switched because my window manager things it knows better than I do where I should be looking.

You want to change the ForegroundLockTimeout registry key or set it via power shell.

by default if you haven't typed anything for a little bit Windows allows an application to steal focus. If you change that value you can prevent windows from ever stealing focus or change how long they have to wait before they're allowed to.

Windows has a ton of little settings you can tweak like this if it's not working quite how you like it.

I personally tweak it the other way to allow a window to pop up and still focus sooner .

If you set up via PowerShell you can do it more dynamically and if you're doing it via the API there's behavior in there too force a lock