Skip to content

Commit 6c92f85

Browse files
authored
Merge pull request #50 from eternal-flame-AD/patch-1
Add auto option to termux-brightness
2 parents 18feace + ecd7d70 commit 6c92f85

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

scripts/termux-brightness

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,23 @@ set -e -u
44
SCRIPTNAME=termux-brightness
55
show_usage() {
66
echo "Usage: $SCRIPTNAME brightness"
7-
echo "Set the screen brightness between 0 and 255"
7+
echo "Set the screen brightness between 0 and 255 or auto"
88
exit 0
99
}
1010

1111
if [ $# != 1 ]; then
1212
show_usage
1313
fi
1414

15-
if ! [[ $1 =~ ^[0-9]+$ ]]; then
16-
echo "ERROR: Arg must be a number between 0 - 255!"
15+
if ! [[ $1 =~ ^([0-9]+)|auto$ ]]; then
16+
echo "ERROR: Arg must be a number between 0 - 255 or auto!"
1717
show_usage
1818
fi
1919

20-
ARGS="--ei brightness $1"
20+
if [ $1 == auto ]; then
21+
ARGS="--ez auto true"
22+
else
23+
ARGS="--ei brightness $1 --ez auto false"
24+
fi
2125

2226
/data/data/com.termux/files/usr/libexec/termux-api Brightness $ARGS

0 commit comments

Comments
 (0)