24 lines · 505 B · executable
#!/usr/bin/env bash
set -euo pipefail

if ! command -v quickshell &>/dev/null; then
    echo "restart-quickshell: quickshell not found" >&2
    exit 1
fi

quickshell kill || true

# Kill any lingering quickshell processes
if pgrep quickshell &>/dev/null; then
    pkill quickshell
    sleep 0.5
fi

# Ensure no other instance is running before starting
if pgrep -x quickshell &>/dev/null; then
    echo "restart-quickshell: failed to stop existing instance" >&2
    exit 1
fi

exec quickshell --daemonize