打开「Automator」,创建「Application」
我们基本上使用ZShell脚本实现所有功能,所以选择:「Actions」「Library」「Utilities」「Run Shell Scripts」,然后编写Shell脚本即可
最后选择Save,可以保存为app格式的文件
# osascript 命令,是 macOS 自带的 AppleScript 执行工具
# 通知标题和内容
title="任务完成"
message="备份已成功完成!"
# 使用 AppleScript 弹出通知
osascript -e "display notification \"${message}\" with title \"${title}\""
# 静音
osascript -e "set volume output muted true"
# 设定音量([0, 100])
osascript -e "set volume output volume 50"
在这里添加启动项:「Settings」「General」「Login Items」「Login Items」