Remove redundant Hyprland launch wrapper
With initial workspace tracking disabled, windows naturally open on the active workspace. Remove the explicit Hyprland workspace dispatch and let shell actions, shell restarts, and presentation terminals launch directly.
This commit is contained in:
@@ -7,33 +7,17 @@ source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
|
||||
tmp_dir="$(mktemp -d)"
|
||||
trap 'rm -rf "$tmp_dir"' EXIT
|
||||
|
||||
cat >"$tmp_dir/hyprctl" <<'SCRIPT'
|
||||
cat >"$tmp_dir/setsid" <<'SCRIPT'
|
||||
#!/bin/bash
|
||||
case "$1" in
|
||||
activeworkspace)
|
||||
printf '{"id":2,"name":"2"}\n'
|
||||
;;
|
||||
dispatch)
|
||||
printf '%s\n' "$2" >>"$TEST_LOG"
|
||||
;;
|
||||
esac
|
||||
printf '%s\n' "$*" >"$TEST_LOG"
|
||||
SCRIPT
|
||||
chmod +x "$tmp_dir/hyprctl"
|
||||
|
||||
cat >"$tmp_dir/jq" <<'SCRIPT'
|
||||
#!/bin/bash
|
||||
cat >/dev/null
|
||||
printf '2\n'
|
||||
SCRIPT
|
||||
chmod +x "$tmp_dir/jq"
|
||||
chmod +x "$tmp_dir/setsid"
|
||||
|
||||
export TEST_LOG="$tmp_dir/log"
|
||||
export PATH="$tmp_dir:$ROOT/bin:$PATH"
|
||||
export HYPRLAND_INSTANCE_SIGNATURE=test
|
||||
|
||||
"$ROOT/bin/omarchy-launch-floating-terminal-with-presentation" "echo hello"
|
||||
|
||||
dispatch=$(<"$TEST_LOG")
|
||||
[[ $dispatch == *'workspace = "2"'* ]] || fail "floating terminal targets active workspace" "$dispatch"
|
||||
[[ $dispatch == *"xdg-terminal-exec --app-id=org.omarchy.terminal"* ]] || fail "floating terminal dispatch launches Omarchy terminal" "$dispatch"
|
||||
pass "floating terminal targets active workspace"
|
||||
launch=$(<"$TEST_LOG")
|
||||
[[ $launch == *"xdg-terminal-exec --app-id=org.omarchy.terminal"* ]] || fail "floating terminal launches Omarchy terminal" "$launch"
|
||||
pass "floating terminal launches Omarchy terminal"
|
||||
|
||||
@@ -100,8 +100,8 @@ assert(
|
||||
'launcher delete closes launcher after confirmation'
|
||||
)
|
||||
assert(
|
||||
confirmDeleteMatch[1].includes('Util.hyprExecCommand(command)'),
|
||||
'launcher delete routes remover through Hyprland'
|
||||
confirmDeleteMatch[1].includes('Util.execDetached(command)'),
|
||||
'launcher delete runs remover through the shell'
|
||||
)
|
||||
|
||||
const activateMatch = launcherQml.match(/function activateIndex\(index\) \{([\s\S]*?)\n \}/)
|
||||
@@ -111,8 +111,8 @@ assert(
|
||||
'launcher does not execute desktop entries directly'
|
||||
)
|
||||
assert(
|
||||
activateMatch[1].includes('gtk-launch') && activateMatch[1].includes('Util.hyprExecCommand'),
|
||||
'launcher routes desktop entry launch through Hyprland'
|
||||
activateMatch[1].includes('gtk-launch') && activateMatch[1].includes('Util.execDetached'),
|
||||
'launcher runs desktop entry launch through the shell'
|
||||
)
|
||||
|
||||
assert(
|
||||
|
||||
@@ -42,12 +42,6 @@ touch "$restart_root/shell/shell.qml"
|
||||
ln -s "$ROOT/bin/omarchy-shell" "$restart_bin/omarchy-shell"
|
||||
ln -s "$ROOT/bin/omarchy-cmd-missing" "$restart_bin/omarchy-cmd-missing"
|
||||
|
||||
cat >"$restart_bin/omarchy-hyprland-launch" <<'SH'
|
||||
#!/bin/bash
|
||||
|
||||
bash -c "$1"
|
||||
SH
|
||||
|
||||
cat >"$restart_bin/qs" <<'SH'
|
||||
#!/bin/bash
|
||||
|
||||
@@ -91,7 +85,7 @@ if [[ ${1:-} == "-j" && ${2:-} == "monitors" ]]; then
|
||||
fi
|
||||
SH
|
||||
|
||||
chmod +x "$restart_bin/qs" "$restart_bin/quickshell" "$restart_bin/hyprctl" "$restart_bin/omarchy-hyprland-launch"
|
||||
chmod +x "$restart_bin/qs" "$restart_bin/quickshell" "$restart_bin/hyprctl"
|
||||
|
||||
printf '101\n202\n' >"$restart_state"
|
||||
|
||||
|
||||
@@ -9,55 +9,8 @@ const fs = require('fs')
|
||||
const utilQml = fs.readFileSync(path.join(root, 'shell/Commons/Util.qml'), 'utf8')
|
||||
|
||||
assert(
|
||||
utilQml.includes('import Quickshell'),
|
||||
'shell launch helper can read Omarchy path'
|
||||
)
|
||||
assert(
|
||||
utilQml.includes('Quickshell.env("OMARCHY_PATH")'),
|
||||
'shell launch helper uses Omarchy path'
|
||||
)
|
||||
assert(
|
||||
/function hyprExecCommand\(command\)[\s\S]*omarchy-hyprland-launch/.test(utilQml),
|
||||
'shell launch helper routes through Hyprland launch command'
|
||||
/function execDetached\(command\)[\s\S]*Quickshell\.execDetached\(\["bash", "-lc", command\]\)/.test(utilQml),
|
||||
'detached command helper uses a login shell'
|
||||
)
|
||||
|
||||
JS
|
||||
|
||||
tmp_dir="$(mktemp -d)"
|
||||
trap 'rm -rf "$tmp_dir"' EXIT
|
||||
|
||||
cat >"$tmp_dir/hyprctl" <<'SCRIPT'
|
||||
#!/bin/bash
|
||||
case "$1" in
|
||||
activeworkspace)
|
||||
printf '{"id":2,"name":"2"}\n'
|
||||
;;
|
||||
dispatch)
|
||||
printf '%s\n' "$2" >>"$TEST_LOG"
|
||||
;;
|
||||
esac
|
||||
SCRIPT
|
||||
chmod +x "$tmp_dir/hyprctl"
|
||||
|
||||
cat >"$tmp_dir/jq" <<'SCRIPT'
|
||||
#!/bin/bash
|
||||
cat >/dev/null
|
||||
printf '2\n'
|
||||
SCRIPT
|
||||
chmod +x "$tmp_dir/jq"
|
||||
|
||||
export TEST_LOG="$tmp_dir/log"
|
||||
export PATH="$tmp_dir:$ROOT/bin:$PATH"
|
||||
export HYPRLAND_INSTANCE_SIGNATURE=test
|
||||
|
||||
"$ROOT/bin/omarchy-hyprland-launch" "echo hello"
|
||||
|
||||
dispatch=$(<"$TEST_LOG")
|
||||
[[ $dispatch == *'workspace = "2"'* ]] || fail "hyprland launch targets active workspace" "$dispatch"
|
||||
[[ $dispatch == *'hl.exec_cmd("echo hello"'* ]] || fail "hyprland launch dispatches command" "$dispatch"
|
||||
pass "hyprland launch targets active workspace"
|
||||
|
||||
unset HYPRLAND_INSTANCE_SIGNATURE
|
||||
"$ROOT/bin/omarchy-hyprland-launch" "printf fallback > $(printf '%q' "$tmp_dir/fallback")"
|
||||
[[ $(<"$tmp_dir/fallback") == "fallback" ]] || fail "hyprland launch falls back outside Hyprland"
|
||||
pass "hyprland launch falls back outside Hyprland"
|
||||
|
||||
Reference in New Issue
Block a user