0
点赞
收藏
分享

微信扫一扫

[macOS] quit when last window close

1. BTT中进行设置

[macOS] quit when last window close_System

 

 2.  添加 blocking apple script:

 

```
tell application "System Events"
    set activeProcesses to first process where it is frontmost
 
    repeat with theProcess in activeProcesses
        if not background only of theProcess then
 
            tell theProcess
                set processName to name
                set theWindows to windows
            end tell
 
            set windowsCount to count of theWindows
        end if
    end repeat
end tell
 
if windowsCount is less than or equal to 1 then
 tell application (get path to frontmost application as text)
 quit
 end tell
else
 tell application "System Events"
 keystroke "w" using command down
 end tell
end if
```



举报

相关推荐

0 条评论