dotfiles/zsh/dark-mode-notify.zsh

24 lines
420 B
Bash
Raw Normal View History

2024-03-22 15:59:05 +00:00
#!/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