#!/bin/bash
INCREMENT=50
MINIMUM=1
MAXIMUM=$(</sys/class/backlight/intel_backlight/max_brightness)
brightness=$(</sys/class/backlight/intel_backlight/brightness)
let brightness/=$INCREMENT
let brightness*=$INCREMENT
if test "_$1" = "_--brighter" ; then
let brightness+=$INCREMENT
fi
if test "_$1" = "_--dimmer" ; then
let brightness-=$INCREMENT
fi
if test $brightness -lt $MINIMUM ; then
brightness=$MINIMUM
fi
if test $brightness -gt $MAXIMUM ; then
brightness=$MAXIMUM
fi
echo $brightness > /sys/class/backlight/intel_backlight/brightness
使脚本可执行sudo chmod +x /opt/brightctl
运行sudo gedit /etc/sudoers并添加以下两行:
ALL ALL=(ALL) NOPASSWD: /opt/brightctl --brighter
ALL ALL=(ALL) NOPASSWD: /opt/brightctl --dimmer
请遵循以下说明:
运行
sudo gedit /opt/brightctl
并复制并粘贴以下文本:使脚本可执行
sudo chmod +x /opt/brightctl
运行
sudo gedit /etc/sudoers
并添加以下两行:在开始菜单中搜索键盘并打开键盘设置。
为亮度增加命令添加键盘绑定 (
sudo /opt/brightctl --brighter
) 并将其绑定到键盘上的亮度键为亮度降低命令 (
sudo /opt/brightctl --dimmer
) 添加键盘绑定并将其绑定到键盘上的亮度键立即尝试使用亮度键。它应该立即工作而无需重新启动或任何东西。