마지막 창 닫기에서 OSX 터미널 종료

마지막 창 닫기에서 OSX 터미널 종료

현재 창을 닫 도록 기본 설정을 설정했지만 CTRL-D마지막/유일한 터미널 창을 닫으면 터미널 응용 프로그램을 종료하고 싶습니다. iTerm2가 이를 수행할 수 있습니다. 터미널이 할 수 있나요?

답변1

applescript 편집기를 열고 붙여 넣기

on is_running(appName)
    tell application "System Events" to (name of processes) contains appName
end is_running

set app to "Terminal"

repeat
    if is_running(app) then
        tell application app
            set WindowNum to get window count
            if WindowNum = 0 then
                quit
            end if
        end tell
        delay 5
    end if
end repeat

그런 다음 스크립트를 저장하고 두 번 클릭하여 실행합니다.

관련 정보