summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.local/bin/wobload61
1 files changed, 30 insertions, 31 deletions
diff --git a/.local/bin/wobload b/.local/bin/wobload
index 0d8b121..599024c 100755
--- a/.local/bin/wobload
+++ b/.local/bin/wobload
@@ -30,39 +30,38 @@ render()
echo "${1%%.*}" > "$wobpipe"
}
-main()
-{
- exe="$1"
- shift
+########
+# MAIN #
+########
- if [ -z "$exe" ]; then
- usage
- exit
- elif [ ! -p "$wobpipe" ]; then
- err "$wobpipe: named pipe does not exist"
- exit 1
- elif ! command -v "$exe" > /dev/null; then
- err "${exe}: command not found"
- exit 127
- fi
+exe="$1"
+shift
- case "$exe" in
- "wpctl")
- wpctl "$@"
+if [ -z "$exe" ]; then
+ usage
+ exit
+elif [ ! -p "$wobpipe" ]; then
+ err "$wobpipe: named pipe does not exist"
+ exit 1
+elif ! command -v "$exe" > /dev/null; then
+ err "${exe}: command not found"
+ exit 127
+fi
- data="$(wpctl get-volume "@DEFAULT_AUDIO_SINK@")"
- render "$(echo "${data##* } * 100" | bc)"
- ;;
- "brightnessctl")
- brightnessctl "$@"
+case "$exe" in
+"wpctl")
+ wpctl "$@"
- data="$(brightnessctl info | grep -o '[0-9]*%')"
- render "${data%\%}"
- ;;
- *)
- err "${exe}: not implemented"
- "$exe" "$@"
- esac
-}
+ data="$(wpctl get-volume "@DEFAULT_AUDIO_SINK@")"
+ render "$(echo "${data##* } * 100" | bc)"
+ ;;
+"brightnessctl")
+ brightnessctl "$@"
-main "$@"
+ data="$(brightnessctl info | grep -o '[0-9]*%')"
+ render "${data%\%}"
+ ;;
+*)
+ err "${exe}: not implemented"
+ "$exe" "$@"
+esac