From 4d3165d8c13178095a028929d8f11b1180cb4312 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 18 Jul 2026 10:29:38 -0700 Subject: [PATCH] Keep new browser windows on current workspace --- bin/omarchy-launch-browser | 10 +++++++++- test/shell.d/launch-browser-test.sh | 12 ++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/bin/omarchy-launch-browser b/bin/omarchy-launch-browser index cc66e7fe..567cffad 100755 --- a/bin/omarchy-launch-browser +++ b/bin/omarchy-launch-browser @@ -18,6 +18,14 @@ systemd-run --user --quiet --collect --unit="omarchy-browser-$(date +%s%N)" \ --property=StandardOutput=null --property=StandardError=null \ uwsm-app -- "$browser_exec" "${@/--private/$private_flag}" -if [[ -n ${HYPRLAND_INSTANCE_SIGNATURE:-} ]]; then +url="" +for argument in "$@"; do + if [[ $argument != "--private" ]]; then + url=$argument + break + fi +done + +if [[ -n $url && -n ${HYPRLAND_INSTANCE_SIGNATURE:-} ]]; then omarchy-hyprland-focus-app "^$(basename "$browser_exec" -stable).*$" || true fi diff --git a/test/shell.d/launch-browser-test.sh b/test/shell.d/launch-browser-test.sh index 6982b908..14908f1c 100644 --- a/test/shell.d/launch-browser-test.sh +++ b/test/shell.d/launch-browser-test.sh @@ -36,6 +36,18 @@ chmod +x "$mock_bin"/* launch_log="$test_tmp/launch" focus_log="$test_tmp/focus" +HOME="$test_home" PATH="$mock_bin:$PATH" HYPRLAND_INSTANCE_SIGNATURE=test \ + OMARCHY_TEST_BROWSER_LAUNCH="$launch_log" OMARCHY_TEST_BROWSER_FOCUS="$focus_log" \ + bash "$ROOT/bin/omarchy-launch-browser" + +[[ ! -e $focus_log ]] || fail "browser launcher leaves a new window on the current workspace" + +HOME="$test_home" PATH="$mock_bin:$PATH" HYPRLAND_INSTANCE_SIGNATURE=test \ + OMARCHY_TEST_BROWSER_LAUNCH="$launch_log" OMARCHY_TEST_BROWSER_FOCUS="$focus_log" \ + bash "$ROOT/bin/omarchy-launch-browser" --private + +[[ ! -e $focus_log ]] || fail "private browser launcher leaves a new window on the current workspace" + HOME="$test_home" PATH="$mock_bin:$PATH" HYPRLAND_INSTANCE_SIGNATURE=test \ OMARCHY_TEST_BROWSER_LAUNCH="$launch_log" OMARCHY_TEST_BROWSER_FOCUS="$focus_log" \ bash "$ROOT/bin/omarchy-launch-browser" "https://example.test/authorize"