#!/bin/sh

# Check which waybar theme is set
THEMEIS=$(readlink -f ~/.config/waybar/style.css | cut -d '-' -f2)

#if the theme is not dark then we need to switch to it
if [ $THEMEIS != "dark.css" ]; then
    SWITCHTO="-dark"
fi

#set the waybar theme
ln -sf ~/.config/waybar/style/style$SWITCHTO.css ~/.config/waybar/style.css

#set the wofi theme
ln -sf ~/.config/wofi/style/style$SWITCHTO.css ~/.config/wofi/style.css

#set the xfce and GTK theme
# if [ $VER == "v4" ]; then
#     xfconf-query -c xsettings -p /Net/IconThemeName -s "Papirus-Dark"
#     gsettings set org.gnome.desktop.interface icon-theme "Papirus-Dark"
# else
#     xfconf-query -c xsettings -p /Net/IconThemeName -s "Adwaita$SWITCHTO"
#     gsettings set org.gnome.desktop.interface icon-theme "Adwaita$SWITCHTO"
# fi

#change the background image and be cool about it ;)
swww img ~/.config/hypr/wallpaper$SWITCHTO.jpg --transition-fps 60 --transition-type wipe --transition-duration 2

#reset mako
sleep 1
killall -SIGUSR2 dunst
dunst &

#restart the waybar
#killall -SIGUSR2 waybar <-- start causing web brwsers to close so switched to below...
pkill waybar
waybar &

# bottom waybar
#waybar --config ~/.config/waybar/config-bottom.jsonc
