delete hyprland vs others

Amolith created

Change summary

dot_local/share/dark-mode.d/executable_swap.sh  | 19 ++++++++++++---
dot_local/share/light-mode.d/executable_swap.sh | 23 ++++++++++++++----
2 files changed, 33 insertions(+), 9 deletions(-)

Detailed changes

dot_local/share/dark-mode.d/executable_swap.sh 🔗

@@ -8,10 +8,21 @@ xrdb -load ~/.Xresources
 pkill polybar
 pkill dunst
 pkill emacs
-i3-msg exec "polybar top"
-i3-msg exec "polybar bottom"
-i3-msg exec "dunst"
-i3-msg exec "emacs --daemon"
+
+matched=$(hyprctl instances | grep -oE "instance [a-zA-Z0-9]{40}_[a-zA-Z0-9]{10}:")
+
+if [[ -n $matched ]]; then
+    hyprctl dispatch exec -- polybar top
+    hyprctl dispatch exec -- polybar bottom
+    hyprctl dispatch exec -- dunst
+    hyprctl dispatch exec -- emacs --daemon
+else
+    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/catppuccin-macchiato.png ~/.wallpaper.png
 feh --bg-scale ~/.wallpaper.png

dot_local/share/light-mode.d/executable_swap.sh 🔗

@@ -5,13 +5,26 @@ chezmoi apply
 xfconf-query -c xsettings -p /Net/ThemeName -s "Catppuccin-Latte-Standard-Rosewater-Light"
 xrdb -load ~/.Xresources
 "$XDG_CONFIG_HOME/emacs/bin/doom" sync
-pkill polybar
+
+matched=$(hyprctl instances | grep -oE "instance [a-zA-Z0-9]{40}_[a-zA-Z0-9]{10}:")
+
 pkill dunst
 pkill emacs
-i3-msg exec "polybar top"
-i3-msg exec "polybar bottom"
-i3-msg exec "dunst"
-i3-msg exec "emacs --daemon"
+if [[ -n $matched ]]; then
+    # Within Hyprland
+    pkill waybar
+    hyprctl dispatch exec -- waybar
+    hyprctl dispatch exec -- dunst
+    hyprctl dispatch exec -- emacs --daemon
+else
+    # Without Hyprland
+    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/catppuccin-latte.png ~/.wallpaper.png
 feh --bg-scale ~/.wallpaper.png