🎉 feat: 添加主题切换功能的服务化配置和脚本
This commit is contained in:
parent
70e5249c16
commit
1d4b9af98c
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>com.user.switchtheme</string>
|
||||
|
||||
<!-- 切换到深色主题 -->
|
||||
<key>StartCalendarInterval</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Hour</key>
|
||||
<integer>12</integer>
|
||||
<key>Minute</key>
|
||||
<integer>30</integer>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Hour</key>
|
||||
<integer>14</integer>
|
||||
<key>Minute</key>
|
||||
<integer>3</integer>
|
||||
</dict>
|
||||
</array>
|
||||
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/bin/bash</string>
|
||||
<string>-c</string>
|
||||
<string>
|
||||
if [[ $(date +%H) == "12" ]]; then
|
||||
osascript /Users/woan/.config/.bin/.Dependencies/setup-kit/osx/switchTopic.scpt dark;
|
||||
elif [[ $(date +%H) == "14" ]]; then
|
||||
osascript /Users/woan/.config/.bin/.Dependencies/setup-kit/osx/switchTopic.scpt light;
|
||||
fi
|
||||
</string>
|
||||
</array>
|
||||
|
||||
<key>RunAtLoad</key>
|
||||
<true />
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,19 @@
|
|||
on run argv
|
||||
-- argv 是一个包含参数的列表
|
||||
set action to item 1 of argv
|
||||
if action is "dark" then
|
||||
tell application "System Events"
|
||||
tell appearance preferences
|
||||
set dark mode to true
|
||||
end tell
|
||||
end tell
|
||||
else if action is "light" then
|
||||
tell application "System Events"
|
||||
tell appearance preferences
|
||||
set dark mode to false
|
||||
end tell
|
||||
end tell
|
||||
else
|
||||
display dialog "未知的参数: " & action
|
||||
end if
|
||||
end run
|
Loading…
Reference in New Issue