Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

kasperkarup

macrumors newbie
Apr 17, 2023
1
0
Oh man, I feel for you - I think people in here don't understand. I also work professionally on the newest Macbook, and this is a UX design issue (my profession is UX and UI design, so I actually design software interfaces).

The issue is with Apple and they way they have assumed that people want to have the focus change automatically. That happens for ALL apps that you open, and it's quite unbelievable as a designer of user-friendly systems, that I can't decide for myself if I want the system to do that by itself, without me wanting it. I think it happens mostly to people like us who work and move fast between apps. It's the issue of the system design, not the user. So YES, the system 'steals' focus when it wants to, leaving the user helpless and suddenly writing in another program or having something pop up over your current app when least expected. I was just searching for a fix for this also, since it finally annoyed me too much. No fix found so far :(
 

MYZ

macrumors regular
Nov 29, 2021
114
73
Canada
Well there is one way that's 99% effective... use only Terminal and use it only in recovery mode with everything else off.
 

nottorp

macrumors 6502a
May 12, 2014
511
617
Romania
What most people in this thread seem to have forgotten is that in older versions of OS X no one dared to steal your focus. It was designed to let you concentrate on your work.

Now it's become as spammy as windows with focus stealing and app store notifications you can't turn off...
 

idealcheese

macrumors regular
Sep 18, 2014
157
93
Sorry to necro this thread but I need to chime in with how annoyed I am at this MacOS "feature" (bug).

If I launch one app that takes a while to load and switch over to my browser to do something else for a minute, the other app will butt itself in front as soon as it's open. Even though I clicked away to the browser after launching it, so it should be clear that the app in the background is not my current priority.

My email client (Spark, love it) gets upgrades often, prompting me to download and install. This can take up to a minute, so I always go and do something else while it does its thing. It drives me up the wall that I get interrupted in whatever else I was doing by Spark popping up once it's open.

I hate this so much and I need to make it stop.
 
  • Like
Reactions: Paulejonesy

ikari-pl

macrumors newbie
Nov 16, 2023
4
2
Reading some of the replies makes me want to SCREAM.

I have been having this issue for at least a few weeks, and it seems like it's getting more intense. Whatever I am doing recently, all of a sudden keyboard input stops working - SOMETHING stealing the keyboard focus, and not telling me what it is. It's even worse than some posters had - no window appears, the menu bar still shows the app that I was working with... it just no longer accepts keyboard input. Often this happens in the middle of typing something. In these cases usually what I'm getting is a few "tick tick tick tick" from the system telling me "your keypress goes nowhere". But if it's keyboard shortcuts, I don't even know if the app is still alive, or just something hijacked my keyboard.

For example: I press CMD+K in Slack, the menu opens, i press enter to pick the highlighted item and... nothing happens, something else already got my keyboard input.

Don't even get me started on how often this happens after one or two letters of a password input.


So, back to OP's question, HOW DO IT FORBID THE ENTIRE WORLD FROM EVER DOING THIS TO ME AGAIN? I think my company doesn't support me throwing the computer out of the window or switching to Asahi linux on the Mac (I'd have to ask), but those seem like more viable solutions than "uninstall everything that's not your terminal"

(edit: I also tried to find some scripts that would detect what's stealing the focus, but the one I found either depended on python AppKit, which was not available for importing and refused to build with pip install, or swift which threw 10KiB of compilation errors in my face)
 

MauiPa

macrumors 68040
Apr 18, 2018
3,438
5,084
Never ever ever happens to me. If it did, I would suspect you got some kind of keystroke logger hack. Time for a major security review of your computer and applications running, maybe you had something breach from a bad web site. G’luck
 

ikari-pl

macrumors newbie
Nov 16, 2023
4
2
A self-respecting keylogger would log the keys I *do* press rather than *preventing* me from pressing them by revealing itself.

So... Is the conclusion that Mac OS really wants the focus to be randomly hijacked by whatever the apps want, and there's no control over it?
 

Brian33

macrumors 65816
Apr 30, 2008
1,471
371
USA (Virginia)
SOMETHING stealing the keyboard focus, and not telling me what it is. It's even worse than some posters had - no window appears,
(edit: I also tried to find some scripts that would detect what's stealing the focus, but the one I found either depended on python AppKit, which was not available for importing and refused to build with pip install,

Maybe you've tried this, I don't know. But others have had success finding out the process name that was stealing focus: https://forums.macrumors.com/threads/active-window-loses-focus.2321723/post-31742015

It explains how to create a "virtual environment" for python with the classes needed for the script to work. Hope it helps.

(If it works, maybe you could post the name of the culprit process -- I'd like to know just out of curiosity.)
 
Last edited:

Brian33

macrumors 65816
Apr 30, 2008
1,471
371
USA (Virginia)
So, back to OP's question, HOW DO IT FORBID THE ENTIRE WORLD FROM EVER DOING THIS TO ME AGAIN?
I don't think this is possible in Monterey.

However, apparently there are some changes in Sonoma related to this issue: https://developer.apple.com/videos/play/wwdc2023/10054/?time=560

"Cooperative App Activation" -- it seems that in Sonoma, "activation is now a request, not a command" and the system decides "if the activation request is appropriate." Maybe that will improve the situation.
 

ikari-pl

macrumors newbie
Nov 16, 2023
4
2
Thanks @Brian33! This is definitely some optimistic note, they're heading in the right direction.
I am having the issue on Sonoma, though. I recently started to think whether maybe it's something about mac system input settings itself -- disabled every other language/keyboard layout I had enabled, and will check whether it changes.

As some pointed out correctly, it's a pain even during login if the system brings back a lot of apps -- but here unless they treat "first minute after login" specially, I can see the system considering a new application starting/new window opening a valid reason to switch to that window. On the other hand, it could evolve in a way the browsers handle popups - if it doesn't result from *user interaction* (a click on the task bar or something?), it could be considered a background activity...

I'll try the script approach again. I think since I don't know MacOS specific packages much, the scripts I tried previously failed on missing dependencies, but I definitely did not try to install "pyobjc", so I tried installing AppKit as a package directly, and that didn't go well, and I lost patience :D
The version you linked works like a charm, so... let's find out 🍿 (it doesn't notice things that aren't app windows, though - for example if you press cmd+space for the spotlight search, this script reports no change)
 
Last edited:
  • Like
Reactions: Brian33

ikari-pl

macrumors newbie
Nov 16, 2023
4
2
Found it! It's `iShotHelper` for me -- `iShot` in general stopped working for me similar time ago (crashes on start).
 
  • Like
Reactions: Brian33

supersophie

macrumors newbie
Mar 15, 2015
11
0
I have spend years tring to stop new opens from taking focus when opening. For example, I have ten Terminals opened over a VPN to work all logged into servers. I click on Safari, and it takes ten seconds to open. But I am typing and suddenly Safari has focus and I am typing a password into Safari. And so on. Or an anti-virus programme pops up some ***** message again whilst I am trying.

In one case an outage on the mobile phone network in part of a city was caused because I was logged into a switch and an app stole focus and ... FFS.
 

idealcheese

macrumors regular
Sep 18, 2014
157
93
@supersophie That sounds pretty serious, yikes.
For me it's not a critical issue but an extremely annoying one. I have a lot of apps that take a long time to open, so I like to let them do that in the background while I do other things. But of course this means that whatever I'm doing will be abruptly interrupted by the app taking focus when it's ready... and in the case of Adobe apps, this means having to watch the splash screens while it continues to load. I hate it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.