我希望计算机睡眠时键盘背光亮起。所以我想知道如何在背光亮起时关闭显示器。或者如何在显示器关闭时打开键盘背光。
答案1
您可以打开显示屏背光。
关闭背光:
echo 0 | sudo tee $(find /sys/devices -path '*backlight/brightness')
打开背光:
cat $(find /sys/class -path '*backlight/max_brightness') | \
sudo tee $(find /sys/devices -path '*backlight/brightness')
解释:
- 找到
brightness
显示器的界面:
find /sys/devices -path '*backlight/brightness'
- 设置
brightness
显示0
权限sudo
:
cat 0 | sudo tee <display brightness>
- 获取
max_brightness
显示内容:
cat $(find /sys/class -path '*backlight/max_brightness')
- 设置
brightness
显示max_brightness
权限sudo
:
cat <max_brightness> | sudo tee <display brightness>