So I have an Alienware 13 R3 with the OLED display, and for the first time I was able to change the brightness using the xrandr command. The problem was the absence of backlight in OLED displays, so I couldn't change the brightness wither with the keyboard, or in any other way. So now that I know I can change it, I want to put a key binding to change the brightness by let's say 0.1. I used this command to change the brightness:
xrandr --output eDP-1-1 --brightness .5
Does anyone know what command to use not to set the brightness, but to increase or decrease it by some value, so I can bind a macro to it. Thanks in advance!
P.S. I am completely new to Linux, so please don't go hard on me :P
Copy bash script below to a file called
bright
Then mark it executable with
chmod a+x bright
Bash Script
MON="DP-1-1"
to your monitor name, ieMON="HDMI-1"
xrandr | grep " connected"
STEP=5
to your step value, egSTEP=2
is less noticeableCall the script with:
bright Up
orbright +
to increase brightness by step valuebright Down
orbright -
to decrease brightness by step valuebright
(with no parameters) to get the current brightness levelHopefully the bash / shell commands can easily be googled for education but if any questions don't hesitate to ask :)
8 minutes after posting answer it occurred to me I could have used
bc
for floating point math and saved ~10 lines of code and the a lot of time from the 1.5 hours to write it shrugs.