diff --git a/osx/com.user.switchtheme.plist b/osx/com.user.switchtheme.plist new file mode 100644 index 0000000..c40eed4 --- /dev/null +++ b/osx/com.user.switchtheme.plist @@ -0,0 +1,40 @@ + + + + Label + com.user.switchtheme + + + StartCalendarInterval + + + Hour + 12 + Minute + 30 + + + Hour + 14 + Minute + 3 + + + + ProgramArguments + + /bin/bash + -c + + 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 + + + + RunAtLoad + + + \ No newline at end of file diff --git a/osx/switchTopic.scpt b/osx/switchTopic.scpt new file mode 100644 index 0000000..7289291 --- /dev/null +++ b/osx/switchTopic.scpt @@ -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