1
0
Fork 0
mirror of https://github.com/kastdeur/dotfiles.git synced 2024-11-01 01:53:32 +01:00
dotfiles/bin/brightness

36 lines
516 B
Text
Raw Normal View History

2016-12-22 02:01:03 +01:00
#!/bin/bash
2017-03-01 10:04:39 +01:00
disps=$(xrandr -q | grep " connected")
2016-12-22 02:01:03 +01:00
2017-04-02 08:01:47 +02:00
if [ "$1" = '-h' ];
then
echo $0 '[-h] [displaycode,[ brightness]]'
exit
fi
2016-12-22 02:01:03 +01:00
if [ ! -z $2 ];
then
disp=$1
bright=$2
2017-03-01 10:04:39 +01:00
elif [ $(echo $disps | wc | awk '{print $1}') = 1 ];
then
disp=$(echo $disps | awk '{print $1}')
2016-12-22 02:01:03 +01:00
else
echo "Available displays:"
2017-03-01 10:04:39 +01:00
echo $disps
2016-12-22 02:01:03 +01:00
echo "What display to use?"
read disp
2017-03-01 10:04:39 +01:00
fi
2016-12-22 02:01:03 +01:00
2017-03-01 10:04:39 +01:00
if [ -z $bright ];
then
if [ ! -z $1 ];
then
bright=$1
else
echo "Brightness[0-1]:"
read bright
fi
2016-12-22 02:01:03 +01:00
fi
xrandr --output $disp --brightness $bright