
現在のウィンドウを閉じるように設定しています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
次に、スクリプトを保存し、ダブルクリックして実行します。