From 1d4b9af98cb21eb815354f1945cec4c4864b782a Mon Sep 17 00:00:00 2001 From: HawkinC Macbook Date: Wed, 21 May 2025 11:37:27 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=89=20feat:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E5=88=87=E6=8D=A2=E5=8A=9F=E8=83=BD=E7=9A=84?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8C=96=E9=85=8D=E7=BD=AE=E5=92=8C=E8=84=9A?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- osx/com.user.switchtheme.plist | 40 ++++++++++++++++++++++++++++++++++ osx/switchTopic.scpt | 19 ++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 osx/com.user.switchtheme.plist create mode 100644 osx/switchTopic.scpt 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