cyongfrank 最近的时间轴更新
cyongfrank

cyongfrank

V2EX 第 597484 号会员,加入于 2022-10-15 07:59:53 +08:00
cyongfrank 最近回复了
2023-06-15 07:58:15 +08:00
回复了 liqinliqin 创建的主题 优惠信息 过了 MFI 认证的 the Apple Find My network 产品,活动价格 29
客服说今天 35 ,不降价了。。。。
2023-05-11 17:03:04 +08:00
回复了 dalang 创建的主题 MacBook Pro mac 使用时窗口经常无故自己切换
> [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.)
2023-05-09 21:41:00 +08:00
回复了 cyongfrank 创建的主题 Apple 新 Apple Watch Pride 表带 [可能]
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   6041 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 15ms · UTC 02:48 · PVG 10:48 · LAX 18:48 · JFK 21:48
Developed with CodeLauncher
♥ Do have faith in what you're doing.