#!/bin/bash # Source this file to import these utilites into your scripts. BLINK_LOCK="/tmp/.blinkstick-toggle" touch "$BLINK_LOCK" # Choose the python needed for blinkstick and the path to blinkstick BS="/usr/bin/python /usr/local/bin/blinkstick" blink_reset() { rm "$BLINK_LOCK" } blink_is_color() { test "$(cat "$BLINK_LOCK" 2>/dev/null)" == "$1" } blink_is_red() { blink_is_color red } blink_is_green() { blink_is_color green } blink_is_busy() { blink_is_color busy } blink_set_color() { echo "$1" > "$BLINK_LOCK" eval "$BS --set-color '$1'" } blink_set_busy() { echo "busy" > "$BLINK_LOCK" eval "$BS --set-color '$1'" }