How to set Keybindings for LCD Brightness in i3wm

The purpose of this tutorial blog post is to describe how to setup LCD brightness keybindings in the i3wm tiling window manager , on your Pinebook.

Below I am providing a script which will be placed in /usr/local/sbin/ , which may be used to set the brightness of the LCD display in increments of +10 or -10.  I will describe the step(s) necessary to activate the script via /etc/sudoers.d so that the keybindings ( bindsym ) in the i3 config can run as sudo without needing to prompt for the password !

First, the scripts... the first one is the ( which does the work ) and the second one is the source file for /etc/sudoers.d which allows the bindsym to call without a password.

# v0.1a
# Mark H. Harris
# 08/31/2017
# Usage: <U|D> <value>

MODE=`echo $1 |tr '[a-z]' '[A-Z]'`
LCDVALUE=`cat /sys/class/backlight/lcd0/brightness`

if [ "$MODE" = "U" ]
  NEWVALUE=$(( $LCDVALUE + $2 ))
  if [ $NEWVALUE -le 100 ]
      echo $NEWVALUE > /sys/class/backlight/lcd0/brightness
      echo $NEWVALUE
      echo $LCDVALUE
  NEWVALUE=$(( $LCDVALUE - $2 ))
  if [ $NEWVALUE -gt 30 ]
      echo $NEWVALUE > /sys/class/backlight/lcd0/brightness
      echo $NEWVALUE
      echo $LCDVALUE


# lcd bright rules
Cmnd_Alias LCDBRIGHT=/usr/local/sbin/


Open a terminal and access root with :

       sudo  -i

Place the  script in the  /usr/local/sbin/  directory.

Set the owner and group with :

       cd  /usr/local/sbin/

       chown  root

       chgrp  root

Make the script executable with :

       chmod  0754

Place the  lcd_bright_rules  file in the  /etc/sudoers.d/  directory.

Set the owner and group with :

       cd  /etc/sudoers.d

       chown  root  lcd_bright_rules

       chgrp  root  lcd_bright_rules

Set special read permissions with :

       chmod  0440  lcd_bright_rules

At this point the system is setup to use the  script.  The last step(s) necessary is to set the keybindings in the i3wm config file.

You do not need root permissions to do the following;  if you're still in root#  please exit.


Change into the i3wm config directory for your default  pine64  i3 user with :

       cd  ~/.config/i3/

Use your favorite editor to edit the  config  file.

Somewhere near the end of the other bindsym entries ,  add these two definitions :

bindsym $mod+Shift+u exec sudo /usr/local/sbin/ u 10
bindsym $mod+Shift+d exec sudo /usr/local/sbin/ d 10

Save the file.

Re-read the config file with :

       mod + Shift + c

Restart the i3wm tiling window manager with :

       mod + Shift + r

Congratulations!  Your brightness keybindings are set for i3wm.

To use the keybindings use :

       mod + Shift + u        (turns up the LCD backlight by 10)

       mod + Shift + d        (turns down the LCD backlight by 10)

marcushh777    Cool

please join us for a chat @   or ssl

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
Hi There,

Thank you for your help. I have a Pinebook 1080P running i3 on top of KDE Neon. I have applied several of your tips.
I followed the instructions step by step but they are not working.

I wonder if anybody has ideas on how to control LCD brightness on i3 in a Pinebook 10180p?
The FAQ in the Wiki suggests the shell command xbrightness

However with Manjaro this seems not to work but I think I remember that with the KDE Neon image it worked. You can just try

Possibly Related Threads...
Thread Author Replies Views Last Post
Information How to set the Power Off key binding in i3wm for the Pinebook MarkHaysHarris777 4 1,067 12-25-2018, 05:57 AM
Last Post: binholz
  How to Configure Screen Brightness in mate on pinebook via terinal? shirman 6 821 12-02-2018, 05:37 AM
Last Post: mikee3000
Information How to manage Wifi in xenial-i3 i3wm image UPDATE MarkHaysHarris777 4 808 09-14-2017, 12:12 AM
Last Post: dahni
Information i3wm xenial-i3 introduction -- mate terminal & battery monitor MarkHaysHarris777 4 1,308 08-31-2017, 04:47 AM
Last Post: shirman

Forum Jump:

Users browsing this thread: 1 Guest(s)