swaync-service-dispatcher: add a usage command

This commit is contained in:
2024-07-24 11:46:52 +00:00
parent 2d73b85f92
commit 15df9edca1

View File

@@ -5,6 +5,17 @@
# otherwise we invoke a s6-rc which does not know where to find files. # otherwise we invoke a s6-rc which does not know where to find files.
export PATH="/etc/profiles/per-user/$(whoami)/bin:/run/current-system/sw/bin:$PATH" export PATH="/etc/profiles/per-user/$(whoami)/bin:/run/current-system/sw/bin:$PATH"
usage() {
echo "swaync-service-dispatcher <action> <service>"
echo ""
echo "actions:"
echo "- swaync-service-dispatcher print <service>"
echo " - prints 'true' or 'false' based on if the service is wanted-up (i.e. started or starting)"
echo "- swaync-service-dispatcher toggle <service>"
echo " - if the service is up, takes it down, and vice versa"
exit 1
}
action="$1" action="$1"
service="$2" service="$2"
@@ -34,10 +45,10 @@ stopService() {
} }
case "$action" in case "$action" in
print) (print)
checkActive checkActive
;; ;;
toggle) (toggle)
case "$(checkActive)" in case "$(checkActive)" in
false) false)
startService startService
@@ -47,4 +58,7 @@ case "$action" in
;; ;;
esac esac
;; ;;
(*)
usage
;;
esac esac