#!/bin/bash
set -euo pipefail

if command -v launchctl >/dev/null 2>&1; then
    launchctl bootout "gui/$(id -u)/studio.khaos.wfl.daemon" >/dev/null 2>&1 || true
    launchctl bootout "gui/$(id -u)/com.khaos.wfl.daemon" >/dev/null 2>&1 || true  # legacy
fi

if command -v systemctl >/dev/null 2>&1; then
    systemctl --user disable --now khaos-wfl.service >/dev/null 2>&1 || true
fi

echo "khaos-wfl user daemon disabled (if previously enabled)."
