/ Desktop / Gobright Control Screen Brightness From Commandline


Published:2017-08-01T13:23:24Z Edited:2017-08-06T13:23:24Z
I used to install xbacklight to control my debian desktop brightness, by setting custom keyboard shortcuts, recently xbacklight failed with an error "No outputs have backlight property". so I wrote a simple command line program to do its job and kinda like its name :)



Whats gobright anyway?

gobright is a command line program to control screen brightness on linux (tested on debian 9 [stretch]), its opensource and wriiten in golang, it can be an alternative to xbacklight.
 
 
 

gobright features

  • Minimum brightness, so no matter how many times you invoke the command brightness may not go down a certain limit.
  • Maximum brightness, so brightness may not go above certian limit.
  • Support incrementing/decrementing brightness or setting it at certain level
  • Free and opensource

 

 

gobright Undercover

gobright set brightness by writing brightness percentage in  /sys/class/backlight/intel_backlight/brightness on debian, the brightness file can be specified on commandl line options, please note that gobright needs ROOT privilages so its can write to brightness file which is owned by ROOT, you can run it by non-ROOT user using setuid (see installation below).

 

Installation

  1. The source code is available on github you can build it like any golang program, also pre-built binary are provided for your convenient in most common architectures.
    git clone https://github.com/coder-me/gobright.git
  2. Put gobright binary in your search path, in $HOME/bin or /usr/bin
  3. Let the ROOT owns it.
    sudo chown root:root /usr/bin/gobright
  4. Finally setuid bit so it can be run by everybody.
    sudo chmod 4555 /usr/bin/gobright

 

Usage of gobright:
 -decr
 Decrement brightness percentage by value
 -file string
 file where to write new brightness value (default "/sys/class/backlight/intel_backlight/brightness")
 -incr
 Increment brightness percentage by value
 -max int
 Max brightness percentage (default 100)
 -min int
 Min brightness percentage (default 10)
 -quiet
 Be Quiet
 -value int
 Set brightness value, or decr/incr brightness by value based on (-incr/-decr) flags (default 50)

 

 

Examples

  • To set brightness to 50% just run
    gobright
  • To decrement brightness by 3% run
    gobright -value 3 -decr
  • To increment brightness by 10% run
    gobright -value 10 -incr
  • To black out your screen run
    gobright -value 100 -min 0 -decr
  • To set brightness 100% run
    gobright -value 100
  • Display Command options help
    gobright -h

 

Sourcecode & Licesne

On https://github.com/coder-me/gobright.git

Next
Previous
Tags