From e81feed04acf53dc2b14613aa47ccf8d5610310c Mon Sep 17 00:00:00 2001 From: "sascha.koenig" Date: Thu, 13 Nov 2025 10:08:10 +0100 Subject: [PATCH] script for starting browser on dual monitor setup --- home/logistik/AZPILOGISTIK01.nix | 2 +- home/logistik/home.nix | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/home/logistik/AZPILOGISTIK01.nix b/home/logistik/AZPILOGISTIK01.nix index 3a0b697..d0d8519 100644 --- a/home/logistik/AZPILOGISTIK01.nix +++ b/home/logistik/AZPILOGISTIK01.nix @@ -17,7 +17,7 @@ "WLR_NO_HARDWARE_CURSORS,1" ]; exec-once = [ - "hyprctl dispatch workspace 1;chromium $WEBAPP_URL &;sleep 2;hyprctl dispatch workspace 2;chromium-isolated $WEBAPP_URL1 &" + "start-browsers" ]; monitor = [ ]; diff --git a/home/logistik/home.nix b/home/logistik/home.nix index 31759b0..a0102b6 100644 --- a/home/logistik/home.nix +++ b/home/logistik/home.nix @@ -42,6 +42,26 @@ --incognito \ "$@" '') + # Start script for browser workspaces + (pkgs.writeShellScriptBin "start-browsers" '' + #!/bin/bash + + # Workspace 1 aktivieren und Chromium starten + ${pkgs.hyprland}/bin/hyprctl dispatch workspace 1 + ${pkgs.chromium}/bin/chromium "$WEBAPP_URL" & + + # Warten, bis Chromium-Fenster zu sehen ist + while true; do + if ${pkgs.hyprland}/bin/hyprctl -j clients | ${pkgs.jq}/bin/jq -e '.[] | select(.class == "chromium-browser")' >/dev/null; then + break + fi + sleep 0.2 + done + + # Danach Workspace 2 und zweiten Browser starten + ${pkgs.hyprland}/bin/hyprctl dispatch workspace 2 + chromium-isolated "$WEBAPP_URL1" & + '') # # Adds the 'hello' command to your environment. It prints a friendly # # "Hello, world!" when run. # pkgs.hello