From 0b3e8c162affe07311474283fa0f5af52e8f0db6 Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Wed, 17 Jun 2026 12:27:12 +0200 Subject: [PATCH] pinwheel: Ensure `hyprland` monitor detection works on start --- hosts/pinwheel/modules/hyprland/default.nix | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/hosts/pinwheel/modules/hyprland/default.nix b/hosts/pinwheel/modules/hyprland/default.nix index 4bbc025..62bc905 100644 --- a/hosts/pinwheel/modules/hyprland/default.nix +++ b/hosts/pinwheel/modules/hyprland/default.nix @@ -55,12 +55,22 @@ let esac } - # Bind workspaces on startup - bind_workspaces - + # Start the event listener first so monitoradded events emitted during + # session startup are not lost in the gap before we begin reading them. ${pkgs.socat}/bin/socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | while read -r line; do handle_event "$line" - done + done & + LISTENER_PID=$! + + # Give socat a moment to actually connect before the initial bind. + sleep 0.2 + bind_workspaces + + # Re-bind once more after the DRM subsystem has had time to enumerate + # external connectors, in case they were not yet present at session start. + (sleep 3; bind_workspaces) & + + wait $LISTENER_PID ''; in {