2018-06-13 05:14:53 +02:00
|
|
|
#!/data/data/com.termux/files/usr/bin/bash
|
|
|
|
set -e -u
|
|
|
|
|
|
|
|
SCRIPTNAME=termux-brightness
|
|
|
|
show_usage() {
|
|
|
|
echo "Usage: $SCRIPTNAME brightness"
|
2019-01-25 06:48:28 +01:00
|
|
|
echo "Set the screen brightness between 0 and 255 or auto"
|
2018-06-13 05:14:53 +02:00
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ $# != 1 ]; then
|
|
|
|
show_usage
|
|
|
|
fi
|
|
|
|
|
2019-01-25 06:48:28 +01:00
|
|
|
if ! [[ $1 =~ ^([0-9]+)|auto$ ]]; then
|
|
|
|
echo "ERROR: Arg must be a number between 0 - 255 or auto!"
|
2018-06-13 05:14:53 +02:00
|
|
|
show_usage
|
|
|
|
fi
|
|
|
|
|
2019-01-25 06:48:28 +01:00
|
|
|
if [ $1 == auto ]; then
|
|
|
|
ARGS="--ez auto true"
|
|
|
|
else
|
|
|
|
ARGS="--ei brightness $1 --ez auto false"
|
|
|
|
fi
|
2018-06-13 05:14:53 +02:00
|
|
|
|
|
|
|
/data/data/com.termux/files/usr/libexec/termux-api Brightness $ARGS
|