omarchy-restart-shell now kills by config dir via quickshell kill and relaunches with --no-duplicate, polling kill until every instance is gone since kill returns without waiting and -n silently exits if one remains. The locked-session refusal reads Hyprland monitor state alone, which covers a hung shell holding the lock; the redundant shell IPC probe, availability guards, and omarchy-shell path indirection are gone. Shell IPC calls now time out (2s default, OMARCHY_SHELL_IPC_TIMEOUT to override) so probing an unresponsive shell fails fast instead of hanging the caller. omarchy-hyprland-launch checks dispatch output for "ok" rather than the exit code, which is 0 even on Lua errors, so a failed dispatch falls through to the bash -lc fallback instead of silently launching nothing. The Quattro upgrade cutover delegates to omarchy-restart-shell instead of carrying its own copy of the lock check, pkill, and readiness loop. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
31 lines
813 B
Bash
Executable File
31 lines
813 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Launch a command on the active Hyprland workspace
|
|
# omarchy:args=<command>
|
|
|
|
cmd="$*"
|
|
[[ -n $cmd ]] || exit 0
|
|
|
|
lua_quote() {
|
|
local value=$1
|
|
|
|
value=${value//\\/\\\\}
|
|
value=${value//\"/\\\"}
|
|
value=${value//$'\n'/\\n}
|
|
printf '"%s"' "$value"
|
|
}
|
|
|
|
active_workspace() {
|
|
hyprctl activeworkspace -j 2>/dev/null | jq -r '.name // .id // empty' 2>/dev/null
|
|
}
|
|
|
|
if [[ -n ${HYPRLAND_INSTANCE_SIGNATURE:-} ]] && omarchy-cmd-present hyprctl && omarchy-cmd-present jq; then
|
|
workspace="$(active_workspace)"
|
|
# hyprctl dispatch exits 0 even on Lua errors, so check for "ok" output.
|
|
if [[ -n $workspace && $(hyprctl dispatch "function() hl.exec_cmd($(lua_quote "$cmd"), { workspace = $(lua_quote "$workspace") }) end" 2>/dev/null) == ok ]]; then
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
exec bash -lc "$cmd"
|