Guillaume-Jean Herbiet on Nostr: Moving away from #iTerm2 back to #macOS #terminal and would like the app to close ...
Moving away from #iTerm2 back to #macOS #terminal and would like the app to close when you quit your last shell? Add the following to ~/.zlogout :
```
if [ "$(ps | wc -l)" -eq 4 ]
then
osascript -e "do shell script \"osascript -e \\\"tell application \\\\\\\"Terminal\\\\\\\" to quit\\\" &> /dev/null &\""
exit
fi
```
Yes, that’s a lot of backslashes but we are doing #AppleScript inside #ZSH, inside #AppleScript inside #ZSH…
Published at
2024-05-24 14:09:23Event JSON
{
"id": "a2f1b99205551c28973863ed0d65cedd52609c93e40dc0d4709be90257bcd15b",
"pubkey": "1e2abaa4d576a34adb5cabb0e6f633fac51ca224b0a16b0bc0c5d39977a74094",
"created_at": 1716559763,
"kind": 1,
"tags": [
[
"t",
"iterm2"
],
[
"t",
"macos"
],
[
"t",
"terminal"
],
[
"t",
"applescript"
],
[
"t",
"zsh"
],
[
"proxy",
"https://mamot.fr/users/gjherbiet/statuses/112496460660829907",
"activitypub"
]
],
"content": "Moving away from #iTerm2 back to #macOS #terminal and would like the app to close when you quit your last shell? Add the following to ~/.zlogout :\n\n```\nif [ \"$(ps | wc -l)\" -eq 4 ]\nthen\n\tosascript -e \"do shell script \\\"osascript -e \\\\\\\"tell application \\\\\\\\\\\\\\\"Terminal\\\\\\\\\\\\\\\" to quit\\\\\\\" \u0026\u003e /dev/null \u0026\\\"\"\n\texit\nfi\n```\n\nYes, that’s a lot of backslashes but we are doing #AppleScript inside #ZSH, inside #AppleScript inside #ZSH…",
"sig": "632cc0335f469d83f873e606ea9a7ad576794a592dd10ff16c7f759fc94d5033852cb52c70c9ea7289b884fd6334f6d799a3cba9408a644510e09581c8fa0bc3"
}