diff options
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/desk | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/bin/desk b/bin/desk index fab05b7..2c018d6 100755 --- a/bin/desk +++ b/bin/desk @@ -10,16 +10,17 @@ error() { pos= case "$1" in - sit | down) pos=780 ;; - stand | up) pos=1150 ;; - *) error "$1" "no position given" ;; +sit | down) pos=780 ;; +stand | up) pos=1150 ;; +walk) pos=1235 ;; +*) error "$1" "no position given" ;; esac printf "ensure bluetoothd is started...\n" { rc-service bluetooth status || doas rc-service bluetooth start; } >/dev/null trap '{ exit 3; }' INT -retries= +retries=3 while true; do printf "running bluedesk...\n" err=$(bluedesk "${pos}" 2>&1 1>/dev/stdout) @@ -27,8 +28,8 @@ while true; do if [ $? -ne 0 ]; then error "$1" "${err}" sleep 1 - retries=$((retries + 1)) - if [ "${#retries}" -gt 2 ]; then + retries=$((retries - 1)) + if [ "${#retries}" -eq 0 ]; then error "$1" "giving up" exit 1 fi |