script for starting browser on dual monitor setup

This commit is contained in:
sascha.koenig 2025-11-13 10:08:10 +01:00
parent c7131a78bb
commit e81feed04a
2 changed files with 21 additions and 1 deletions

View File

@ -17,7 +17,7 @@
"WLR_NO_HARDWARE_CURSORS,1" "WLR_NO_HARDWARE_CURSORS,1"
]; ];
exec-once = [ exec-once = [
"hyprctl dispatch workspace 1;chromium $WEBAPP_URL &;sleep 2;hyprctl dispatch workspace 2;chromium-isolated $WEBAPP_URL1 &" "start-browsers"
]; ];
monitor = [ monitor = [
]; ];

View File

@ -42,6 +42,26 @@
--incognito \ --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 # # Adds the 'hello' command to your environment. It prints a friendly
# # "Hello, world!" when run. # # "Hello, world!" when run.
# pkgs.hello # pkgs.hello