1
wclebb 2019-12-06 23:34:21 +08:00 via iPhone
邮件?
|
2
uhian 2019-12-07 00:03:44 +08:00
窗口切换指的是切换到别的 app 还是切换到主窗口?如果是主窗口,会不会有什么隐藏的 app 在主窗口有消息。比如有的 app 有新版本,你在别的窗口正忙,他会跳出来导致回到主窗口。不知道我说明白没。。。。。。
|
4
starrystarry 2019-12-07 09:17:04 +08:00
很久之前似乎遇到过类似的问题,当时用了一段代码查找到了元凶,卸载之后就好了。只想到这些,细节全忘了……
|
5
dalang OP @starrystarry #4 如果是软件层的问题,至少感觉比应用故障要好一点。
|
6
starrystarry 2019-12-07 11:55:18 +08:00 1
@dalang 搜「 Mac 失去焦点」试试
|
7
leeum 2019-12-08 00:09:17 +08:00
10.14 的时候出现相同问题,升级到 10.15 就没再出现过
|
9
dalang OP @starrystarry #6 脚本用起来了,看看能不能起作用。
|
10
feellucky 2020-05-07 23:58:20 +08:00
我今天遇到两次,在没有操作键鼠的情况下自己出现了切换窗口的浮层(似乎并没有真的切换)。一开始以为是 mac 被人远程控制了,因为前几天打开了远程管理的共享,但是关掉共享之后又出现一次。有搜到这个帖: https://discussionschinese.apple.com/thread/250914911,没有解决问题。
看了下拥有辅助功能权限的应用,嫌疑最大的是 karabiner-element 、logi option 、magnet 和 mos 。 |
11
feellucky 2020-05-07 23:59:41 +08:00
mac mini 2018 + 蓝牙键鼠、catalina 10.15.4
|
12
dalang OP 我后来发现确实是 chrome 的原因,解决方法是下载完重装
|
13
cyongfrank 2023-05-11 17:03:04 +08:00
> [How do I tell which app stole my focus in OS X?]( https://superuser.com/questions/734007/how-do-i-tell-which-app-stole-my-focus-in-os-x)
```python #!/usr/bin/python try: from AppKit import NSWorkspace except ImportError: print("Can't import AppKit -- try `pip install PyObjC`") print("(see instructions for running in a venv with PyObjC)") exit(1) from datetime import datetime from time import sleep last_active_name = None while True: active_app = NSWorkspace.sharedWorkspace().activeApplication() if active_app['NSApplicationName'] != last_active_name: last_active_name = active_app['NSApplicationName'] print('%s: %s [%s]' % ( datetime.now().strftime('%Y-%m-%d %H:%M:%S'), active_app['NSApplicationName'], active_app['NSApplicationPath'] )) sleep(1) ``` 1. Create a directory, and save the script above into it as "focus-stealer.py" 2. In a terminal in that directory enter these commands: ```sh /usr/bin/python3 -m venv venv ./venv/bin/python -m pip install PyObjC ``` (This creates a new, isolated Python virtual environment, just for this script, and installs PyObjC into it. This avoids modifying your system Python installation or needing to use sudo.) 3. Now you can run the script. In a terminal in that same directory run: ```sh ./venv/bin/python ./focus-stealer.py ``` (In the future, you can skip directly to this step—no need to reinstall things.) |