executable_swap.sh

 1#!/usr/bin/env bash
 2
 3sed -i 's/light/dark/g' ~/.config/chezmoi/chezmoi.toml
 4chezmoi apply
 5xfconf-query -c xsettings -p /Net/ThemeName -s "Catppuccin-Macchiato-Standard-Rosewater-Dark"
 6xrdb -load ~/.Xresources
 7"$XDG_CONFIG_HOME/emacs/bin/doom" sync
 8pkill polybar
 9pkill dunst
10pkill emacs
11
12matched=$(hyprctl instances | grep -oE "instance [a-zA-Z0-9]{40}_[a-zA-Z0-9]{10}:")
13
14if [[ -n $matched ]]; then
15    hyprctl dispatch exec -- polybar top
16    hyprctl dispatch exec -- polybar bottom
17    hyprctl dispatch exec -- dunst
18    hyprctl dispatch exec -- emacs --daemon
19else
20    i3-msg exec "polybar top"
21    i3-msg exec "polybar bottom"
22    i3-msg exec "dunst"
23    i3-msg exec "emacs --daemon"
24fi
25
26unlink ~/.wallpaper.png
27ln -s ~/Pictures/walls/catppuccin-macchiato.png ~/.wallpaper.png
28feh --bg-scale ~/.wallpaper.png
29notify-send "Theme switch complete"