diff options
| author | Robert Günzler <r@gnzler.io> | 2022-11-18 17:46:49 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2022-11-18 18:38:21 +0100 |
| commit | 605831ecb159ded47c7c56fc51fcb0ed685de143 (patch) | |
| tree | 20c79e65a78c97995aab44b03eeb1344cd83bb06 /bin/desk | |
| parent | 811e68ea640e807d5f5aa86baa06e39c18852d60 (diff) | |
bin/desk: add walk preset
Diffstat (limited to 'bin/desk')
| -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 |