#!/usr/bin/env bash

sed -i 's/dark/light/g' ~/.config/chezmoi/chezmoi.toml
chezmoi apply
xfconf-query -c xsettings -p /Net/ThemeName -s "Everforest-Light-Soft"
xfconf-query -c xsettings -p /Net/IconThemeName -s "Everforest-Light"
gsettings set org.gnome.desktop.interface gtk-theme "Everforest-Light-Soft"
gsettings set org.gnome.desktop.interface icon-theme "Everforest-Light"
gsettings set org.gnome.desktop.interface color-scheme 'prefer-light'
xrdb -load ~/.Xresources
"$XDG_CONFIG_HOME/emacs/bin/doom" sync

pkill dunst
pkill emacs
if [[ -n $WAYLAND_DISPLAY ]]; then
    pkill waybar
    hyprctl dispatch exec -- waybar
    hyprctl dispatch exec -- dunst
    hyprctl dispatch exec -- emacs --daemon
else
    pkill polybar
    i3-msg exec "polybar top"
    i3-msg exec "polybar bottom"
    i3-msg exec "dunst"
    i3-msg exec "emacs --daemon"
fi

unlink ~/.wallpaper.png
ln -s ~/Pictures/walls/everforest-soft-light.png ~/.wallpaper.png
feh --bg-scale ~/.wallpaper.png
notify-send "Theme switch complete"
