Replace shell instances with quickshell's synchronous kill
With quickshell-git, qs kill blocks until the instance has fully exited, so restarting no longer needs to resolve pids and wait for them to die. Kill in a loop until none remain - each call takes the oldest, and duplicates from stale sessions are the reason this script exists. The timeout bounds a wedged shell that can't process the quit message: its kill would otherwise report success after Qt's 30s wait gives up, re-killing the same undead instance forever. The test mock now kills real processes synchronously to match. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
21eacb324a
commit
afcbcc0e36
@@ -18,15 +18,10 @@ if [[ $(hyprctl -j monitors 2>/dev/null) == *'"LOCK"'* ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for (( attempt = 0; attempt < 50; attempt++ )); do
|
||||
quickshell kill -p "$CONFIG_DIR" --any-display >/dev/null 2>&1 || break
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
if (( attempt == 50 )); then
|
||||
echo "Could not stop all Omarchy shell instances." >&2
|
||||
exit 1
|
||||
fi
|
||||
# Each kill stops the oldest matching instance and only returns once it has
|
||||
# fully exited, so the no-duplicate launch below can't race a dying shell.
|
||||
# Requires our quickshell-git build; 0.3.0's kill returns immediately.
|
||||
while timeout 5 quickshell kill -p "$CONFIG_DIR" --any-display >/dev/null 2>&1; do :; done
|
||||
|
||||
setsid quickshell -n -p "$CONFIG_DIR" >/dev/null 2>&1 &
|
||||
|
||||
|
||||
Reference in New Issue
Block a user