#!/bin/sh

export SVDIR="{{@@ user_svdir @@}}"

maybe() {
    command -v $1 > /dev/null &&
    env "$@"
}

if pidof swayidle > /dev/null; then
    maybe sv down swayidle
    maybe systemctl --user stop sway-idle.service
else
    maybe sv up swayidle
    maybe systemctl --user start sway-idle.service
fi
