From 677c98bdde36e0c59eee665ac1c28d9ee79b8e9f Mon Sep 17 00:00:00 2001 From: David Kramer Date: Tue, 12 Jun 2018 21:14:53 -0600 Subject: [PATCH] Add termux-brightness --- scripts/termux-brightness | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 scripts/termux-brightness diff --git a/scripts/termux-brightness b/scripts/termux-brightness new file mode 100755 index 0000000..4e19c6a --- /dev/null +++ b/scripts/termux-brightness @@ -0,0 +1,22 @@ +#!/data/data/com.termux/files/usr/bin/bash +set -e -u + +SCRIPTNAME=termux-brightness +show_usage() { + echo "Usage: $SCRIPTNAME brightness" + echo "Set the screen brightness between 0 and 255" + exit 0 +} + +if [ $# != 1 ]; then + show_usage +fi + +if ! [[ $1 =~ ^[0-9]+$ ]]; then + echo "ERROR: Arg must be a number between 0 - 255!" + show_usage +fi + +ARGS="--ei brightness $1" + +/data/data/com.termux/files/usr/libexec/termux-api Brightness $ARGS