项目作者: xswxm

项目描述 :
A script for adjusting the brightness for keyboard and screen
高级语言: Shell
项目地址: git://github.com/xswxm/Ubuntu-Brightness-Adjustment.git
创建时间: 2017-06-06T06:32:42Z
项目社区:https://github.com/xswxm/Ubuntu-Brightness-Adjustment

开源协议:MIT License

下载


Ubuntu Brightness Adjustment

It is a bash script for adjusting brightness for both your keyboard and screen.

Setting Up

Edit the script. The existing file locations are for Asus ux303 running Ubuntu 16.04 so you may have to replace the path to yours.

  1. if [ $1 == '-k' ]; then
  2. path="/sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/"
  3. elif [ $1 == '-d' ]; then
  4. path="/sys/class/backlight/intel_backlight/"
  5. else
  6. exit
  7. fi

Move file to /usr/local/bin

  1. sudo mv YourDownloadedFileFolder/brightness /usr/local/bin

Set persmission and user group to root

  1. sudo chmod 755 /usr/local/bin/brightness
  2. sudo chown root:root /usr/local/bin/brightness

Add exceptions for the script so it can run without asking for entering password

  1. sudo visudo

Navigate to the last line and add a line as listed below (Replace the USERNAME with your username)

  1. USERNAME ALL=(root) NOPASSWD: /usr/local/bin/brightness

Save it and you are ready to go

How to Use

Open System Settings - Keyboard - Shortcuts and add your commands

  1. # Example commands
  2. # Set the the value keyboard brightness to 0
  3. sudo brightness -k -set 0
  4. # Increase keyboard brightness by 1
  5. sudo brightness -k -inc 1
  6. # Decrease keyboard brightness by 1
  7. sudo brightness -k -dec 1
  8. # Set the the value screen brightness to 200
  9. sudo brightness -d -set 200
  10. # Increase screen brightness by 100
  11. sudo brightness -d -inc 100
  12. # Decrease screen brightness by 100
  13. sudo brightness -d -dec 100

License

MIT