dotfiles/zsh/dark-mode-notify.zsh

23 lines
420 B
Bash
Executable file

#!/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