开发者

How to change the Monitor brightness on Linux?

开发者 https://www.devze.com 2023-03-18 02:14 出处:网络
How do I programmatically change the moni开发者_运维知识库tor brightness on Linux? I\'m using SLES 11.You can always use

How do I programmatically change the moni开发者_运维知识库tor 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


The ddcutil application can change an external monitor's actual backlight brightness via the VESA DDC/MCCS standard (xrandr can only move the X11 output within a monitor's currently set limits, it can't change the actual backlight brightness). This should work for any monitors that support that capability via Display Data Channel (DDC has been around for some time, it is be widely supported, but for external monitors only). I use ddcutil to automatically adjust my monitor based on the ambient light level sampled from a webcam. Ddcutil uses the i2c-dev kernel module (modprobe i2c-dev or set it to load at boot).

ddcutil detect                    # Get list of DDC displays
ddcutil --display 2 capabilities  # List VCP feature key numbers
ddcutil --display 2 getvcp 10     # Get brightness by key number
ddcutil --display 2 setvcp 10 50  # Set brightness to 50                                                                            


You might look into using xgamma. Although it's not pure code, at least it's just a command line utility.


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


Here is the simple step to control brightness in Linux based system

First, you have to know the monitoring screen connected you.

To know this run this command

xrandr -q

It will give useful information about the screen

How to change the Monitor brightness on Linux?

( Here my screen connected to eDP, It might be different for your system )

After knowing that run the below command

xrandr --output eDP --brightness [0-10]

Replace eDP by your connected screen from the above output.

you can choose normal brightness values from 0.1 to 1.0


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


command for this:

xgamma -gamma 0.7

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号