macOS 的“关闭窗口 ≠ 退出应用”逻辑,对于强迫症或者刚转系统的朋友来说真的很难受!😫 每次都要 Cmd+Q ,不然 Dock 栏永远一堆小白点。 作为一名喜欢折腾的前端工程师 👨💻,我写了一个 BetterTouchTool (BTT) 脚本,完美实现了“点击红叉 = 退出应用”,而且比网上的普通脚本更智能!
-- 配置你的“保活”应用名单
set keepAliveApps to {"WeChat", "Telegram", "Spotify", "Music", "DingTalk"}
tell application "System Events"
set frontApp to first application process whose frontmost is true
set appName to name of frontApp
-- 白名单检查:如果是常驻应用,只关闭不退出
if keepAliveApps contains appName then
keystroke "w" using command down
return
end if
-- 获取窗口类型,防止误关设置弹窗
try
set currentSubrole to subrole of front window of frontApp
on error
set currentSubrole to "Unknown"
end try
set standardWindowCount to count of (windows of frontApp where subrole is "AXStandardWindow")
end tell
-- 逻辑判断
if currentSubrole is not "AXStandardWindow" then
tell application "System Events" to keystroke "w" using command down
return
end if
if standardWindowCount is less than or equal to 1 then
tell application appName to quit
else
tell application "System Events" to keystroke "w" using command down
end if
1
InternetExplorer 21 小时 54 分钟前 我有一计:关掉“为打开的应用程序显示指示灯”
|
2
ATiGr 20 小时 35 分钟前
其实吧,刚转 Mac 我也这样,后来发现这样反而会增加下一次开 app 的延迟(图标多弹个一两下),觉得得不偿失然后就放任不管了。反正日常用系统也不卡,真的卡了再说。
|
3
penisulaS 20 小时 29 分钟前
其实我在 win 和 mac 下,都很少会关闭打开的 app ,总是开着。反正内存大,还经常用
|
4
p286767375 20 小时 15 分钟前
win 不也有很多 app 点击叉叉后不退出,留在右下角吗?
而且“每次都要 Cmd+Q” 才完全退出,这个是强大的统一的快捷键啊,比任何工具都好使。 另外 cmd+option+esc 可以强制退出某个应用 |
5
yinzhenyu OP @p286767375 其实最大的问题是很多应用即使关掉所有的窗口了菜单的当前应用还是没有改变,按照正常的逻辑菜单栏应该显示上个堆叠的应用
|
7
yinzhenyu OP @InternetExplorer 此计亦可
|