diff --git a/options/custom/scripts/remote.sh b/options/custom/scripts/remote.sh index 5ae2131..b6202ae 100644 --- a/options/custom/scripts/remote.sh +++ b/options/custom/scripts/remote.sh @@ -68,6 +68,11 @@ fi # Suspend VM after connection ends if [[ "${argc_vm:-}" ]]; then - virsh suspend "${argc_host:-}" - notify-send "> remote" "${argc_host:-} paused" --urgency low + # Delay to avoid suspending shutdown + sleep 5 + + if [[ "$(virsh domstate "${argc_host:-}")" != "shut off" ]]; then + virsh suspend "${argc_host:-}" + notify-send "> remote" "${argc_host:-} paused" --urgency low + fi fi