home/bin/brightness.sh

25 lines
481 B
Bash
Raw Normal View History

2020-06-06 12:39:11 +02:00
#! /bin/bash
CURRENT=`xrandr --verbose | grep -m 1 -i brightness | cut -f2 -d ' '`
2020-09-16 20:31:57 +02:00
OUTPUT=`xrandr|grep ' connected'|grep 'primary'|cut -d' ' -f 1`
2020-06-06 12:39:11 +02:00
GAP=0.1
NEWVALUE=${CURRENT}
case $1 in
up)
NEWVALUE=`echo "${CURRENT}+${GAP}"|bc -l`
;;
down)
NEWVALUE=`echo "${CURRENT}-${GAP}"|bc -l`
;;
reset)
NEWVALUE=1
;;
read)
echo "${CURRENT}*100/1"|bc
2020-09-16 20:31:57 +02:00
exit 0
2020-06-06 12:39:11 +02:00
;;
esac
2020-09-16 20:31:57 +02:00
xrandr --output ${OUTPUT} --brightness ${NEWVALUE}