How do I programmatically change the monitor brightness on Linux?
I\'m using SLES 11.
edit /etc/default/grub
file and add
“pcie_aspm=force acpi_backlight=vendor”
after
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”
after the changes, the whole line will look like this
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash pcie_aspm=force acpi_backlight=vendor”
Chirag Singh
If you have multiple displays and php installed, put this in
/usr/bin/brightness
#!/usr/bin/php
<?
$br=(double)$argv[1];
if(!$br||$br>1) die("enter brightness lvl 0.1 - 1");
preg_match_all('!^(\S+)!m',`xrandr --current | grep ' connected'`,$m);
foreach($m[1] as $display){
echo `xrandr --output $display --brightness $br`."\n";
}
than call brightness .7
You can try using xbacklight.
xbacklight -set 100
command for this:
xgamma -gamma 0.7
For me it works perfectly with xbacklight
.
If you for example wish to set up a key binding, you can use
bindsym $SUPER+Shift+plus exec xbacklight -inc 10
bindsym $SUPER+Shift+minus exec xbacklight -dec 10
in your window managers config (I use i3) to regulate your screen's brightness level.
I wouldn't recommend xrandr
for this since it doesn't stop at 100% brightness automatically.
On my machine I run the following as root:
echo -n 10 > /sys/devices/virtual/backlight/acpi_video0/brightness