Fix Wayland detection

Amolith created

Change summary

dot_local/bin/executable_startup.tmpl | 36 ++++++++++++----------------
1 file changed, 15 insertions(+), 21 deletions(-)

Detailed changes

dot_local/bin/executable_startup.tmpl 🔗

@@ -1,30 +1,25 @@
 #!/bin/bash
 
-matched=$(hyprctl instances | grep -oE "instance [a-zA-Z0-9]{40}_[a-zA-Z0-9]{10}:")
-
-if [[ -n $matched ]]; then
-	# We're in Wayland
-	hyprctl dispatch exec -- "waybar"
-	hyprctl dispatch exec -- "blueman-applet"
-	hyprctl dispatch exec -- "gammastep"
-	hyprctl dispatch exec -- "/usr/lib/geoclue-2.0/demos/agent"
-	hyprctl dispatch exec -- "dunst"
-	hyprctl dispatch exec -- "playerctl pause"
-	hyprctl dispatch exec -- "solaar -w hide"
-	hyprctl dispatch exec -- "emacs --daemon"
-	hyprctl dispatch exec -- "xrdb -load ~/.Xresources"
-	hyprctl dispatch exec -- "xfsettingsd"
-	hyprctl dispatch exec -- "darkman get"
-	hyprctl dispatch exec -- "dbus-update-activation-environment --all"
-	hyprctl dispatch exec -- "telegram-desktop"
+if [[ -n $WAYLAND_DISPLAY ]]; then
+	hyprctl -i 0 dispatch exec -- "waybar"
+	hyprctl -i 0 dispatch exec -- "blueman-applet"
+	hyprctl -i 0 dispatch exec -- "gammastep"
+	hyprctl -i 0 dispatch exec -- "/usr/lib/geoclue-2.0/demos/agent"
+	hyprctl -i 0 dispatch exec -- "dunst"
+	hyprctl -i 0 dispatch exec -- "playerctl pause"
+	hyprctl -i 0 dispatch exec -- "solaar -w hide"
+	hyprctl -i 0 dispatch exec -- "emacs --daemon"
+	hyprctl -i 0 dispatch exec -- "xrdb -load ~/.Xresources"
+	hyprctl -i 0 dispatch exec -- "xfsettingsd"
+	hyprctl -i 0 dispatch exec -- "dbus-update-activation-environment --all"
+	hyprctl -i 0 dispatch exec -- "telegram-desktop"
 	{{- if eq .chezmoi.hostname "angmar" }}
-	hyprctl dispatch exec -- "caddy start --adapter caddyfile --config ~/Bulk/Media/Caddyfile"
-	hyprctl dispatch exec -- "firefox-developer-edition"
+	hyprctl -i 0 dispatch exec -- "caddy start --adapter caddyfile --config ~/Bulk/Media/Caddyfile"
+	hyprctl -i 0 dispatch exec -- "firefox-developer-edition"
 	{{- end }}
 	sleep 5
 	hyprctl dispatch exec -- "nextcloud"
 else
-    # We're in i3 (X.org)
 	i3-msg exec "polybar top"
 	i3-msg exec "polybar bottom"
 	i3-msg exec "feh --bg-scale ~/.wallpaper.png"
@@ -41,7 +36,6 @@ else
 	i3-msg exec "emacs --daemon"
 	i3-msg exec "xrdb -load ~/.Xresources"
 	i3-msg exec "xfsettingsd"
-	i3-msg exec "darkman get"
 	i3-msg exec "dbus-update-activation-environment --all"
 	{{- if eq .chezmoi.hostname "angmar" }}
 	i3-msg exec "caddy start --adapter caddyfile --config ~/Bulk/Media/Caddyfile"