From 15df9edca16ae1924c733a2f6822ab41e26ff0ca Mon Sep 17 00:00:00 2001 From: Colin Date: Wed, 24 Jul 2024 11:46:52 +0000 Subject: [PATCH] swaync-service-dispatcher: add a usage command --- .../swaync-service-dispatcher | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/hosts/common/programs/swaynotificationcenter/swaync-service-dispatcher b/hosts/common/programs/swaynotificationcenter/swaync-service-dispatcher index 3d6135bda..cf1387829 100755 --- a/hosts/common/programs/swaynotificationcenter/swaync-service-dispatcher +++ b/hosts/common/programs/swaynotificationcenter/swaync-service-dispatcher @@ -5,6 +5,17 @@ # 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" +usage() { + echo "swaync-service-dispatcher " + echo "" + echo "actions:" + echo "- swaync-service-dispatcher print " + echo " - prints 'true' or 'false' based on if the service is wanted-up (i.e. started or starting)" + echo "- swaync-service-dispatcher toggle " + echo " - if the service is up, takes it down, and vice versa" + exit 1 +} + action="$1" service="$2" @@ -34,10 +45,10 @@ stopService() { } case "$action" in - print) + (print) checkActive ;; - toggle) + (toggle) case "$(checkActive)" in false) startService @@ -47,4 +58,7 @@ case "$action" in ;; esac ;; + (*) + usage + ;; esac