script to controll brightness. Changes user to avoid sudo needs

This commit is contained in:
TUNQRT 2025-09-30 16:34:15 +02:00
parent d2d606417f
commit 7ab4d72769
1 changed files with 10 additions and 0 deletions

10
brightness Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
input=$1
input=${input%\%}
re_num='^100$|(^[0-9]{1,2}$)' #100 nebo [0-9] jednou az dvakrat
[[ $input =~ $re_num ]] && val=$(($input*240)) || echo "NavN"
su -c "sudo brightnessctl s $val" bash >/dev/null
#echo "brightness set to $val"