Greetings,
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/lcd_bright.sh , 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 lcd_bright.sh ( which does the work ) and the second one is the source file for /etc/sudoers.d which allows the bindsym to call lcd_bright.sh without a password.
lcd_bright.sh
lcd_bright_rules
Procedure:
Open a terminal and access root with :
sudo -i
Place the lcd_bright.sh script in the /usr/local/sbin/ directory.
Set the owner and group with :
cd /usr/local/sbin/
chown root lcd_bright.sh
chgrp root lcd_bright.sh
Make the script executable with :
chmod 0754 lcd_bright.sh
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 lcd_bright.sh 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.
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 :
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)
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/lcd_bright.sh , 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 lcd_bright.sh ( which does the work ) and the second one is the source file for /etc/sudoers.d which allows the bindsym to call lcd_bright.sh without a password.
lcd_bright.sh
Code:
#!/bin/bash
#
# lcd_bright.sh v0.1a
#
# Mark H. Harris
# 08/31/2017
#
# Usage: lcd_bright.sh <U|D> <value>
#
MODE=`echo $1 |tr '[a-z]' '[A-Z]'`
LCDVALUE=`cat /sys/class/backlight/lcd0/brightness`
if [ "$MODE" = "U" ]
then
NEWVALUE=$(( $LCDVALUE + $2 ))
if [ $NEWVALUE -le 100 ]
then
echo $NEWVALUE > /sys/class/backlight/lcd0/brightness
echo $NEWVALUE
else
echo $LCDVALUE
fi
else
NEWVALUE=$(( $LCDVALUE - $2 ))
if [ $NEWVALUE -gt 30 ]
then
echo $NEWVALUE > /sys/class/backlight/lcd0/brightness
echo $NEWVALUE
else
echo $LCDVALUE
fi
fi
lcd_bright_rules
Code:
# lcd bright rules
Cmnd_Alias LCDBRIGHT=/usr/local/sbin/lcd_bright.sh
ALL ALL=NOPASSWD: LCDBRIGHT
Procedure:
Open a terminal and access root with :
sudo -i
Place the lcd_bright.sh script in the /usr/local/sbin/ directory.
Set the owner and group with :
cd /usr/local/sbin/
chown root lcd_bright.sh
chgrp root lcd_bright.sh
Make the script executable with :
chmod 0754 lcd_bright.sh
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 lcd_bright.sh 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.
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 :
Code:
bindsym $mod+Shift+u exec sudo /usr/local/sbin/lcd_bright.sh u 10
bindsym $mod+Shift+d exec sudo /usr/local/sbin/lcd_bright.sh 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
please join us for a chat @ irc.pine64.xyz:6667 or ssl irc.pine64.xyz:6697
( I regret that I am not able to respond to personal messages; let's meet on irc! )

please join us for a chat @ irc.pine64.xyz:6667 or ssl irc.pine64.xyz:6697
( I regret that I am not able to respond to personal messages; let's meet on irc! )