Add support for using dark/light mode

This commit is contained in:
Jonny Barnes 2024-03-22 15:59:05 +00:00
parent 12dd8faba4
commit 7187d52ee6
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
3 changed files with 148 additions and 89 deletions

23
zsh/dark-mode-notify.zsh Executable file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env zsh
function switch-dark-mode()
{
local darkMode=true;
if [[ $(defaults read -g AppleInterfaceStyle 2> /dev/null) != 'Dark' ]]; then
darkMode=false
fi
if [[ $darkMode == true ]]; then
echo "Switched to dark mode"
export MACOS_APPEARANCE="dark"
else
echo "Switched to light mode"
export MACOS_APPEARANCE="light"
fi
# Reload zshrc
pkill -usr1 zsh
}
switch-dark-mode