matugen: change macOS dark/light mode

This commit is contained in:
Nico 2026-01-01 16:06:30 +11:00
parent 71fabc3a5f
commit d39af55417
Signed by: nico
SSH key fingerprint: SHA256:XuacYOrGqRxC3jVFjfLROn1CSvLz85Dec6N7O9Gwu/0
2 changed files with 13 additions and 0 deletions

View file

@ -103,3 +103,7 @@ compare_to = "{{colors.primary.default.hex}}"
pre_hook = "defaults write -globalDomain AppleAccentColor -int {{closest_color}}"
post_hook = "~/.config/matugen/scripts/macos-accent-notification"
input_path = "/dev/null"
[templates.macos-dark-mode]
input_path = "/dev/null"
post_hook = '~/.config/matugen/scripts/macos-darkmode.sh {{mode}}'

View file

@ -0,0 +1,9 @@
#!/bin/sh
if [ "$1" = "dark" ]; then
osascript -e 'tell application "System Events" to tell appearance preferences to set dark mode to true'
elif [ "$1" = "light" ]; then
osascript -e 'tell application "System Events" to tell appearance preferences to set dark mode to false'
else
echo "$0: [dark|light]"
fi