How do I programmatically change the monitor brightness on Linux?
I'm using SLES 11.
You can always use
xrandr --output LVDS1 --brightness 0.9
You can try using xbacklight.
xbacklight -set 100
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
You might look into using xgamma. Although it's not pure code, at least it's just a command line utility.
edit /etc/default/grub file and add
“pcie_aspm=force acpi_backlight=vendor” after
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”
after the changes whole line will look like this
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash pcie_aspm=force acpi_backlight=vendor”
for complete detail visit the link.
http://hackingzones.com/increasedecrease-brightness-in-linux-ubuntu-pear-os-backtrackkali/
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
来源:https://stackoverflow.com/questions/6625836/how-to-change-the-monitor-brightness-on-linux