08-31-2017, 01:35 PM
(This post was last modified: 08-31-2017, 02:16 PM by MarkHaysHarris777.)
(08-31-2017, 12:28 PM)shirman Wrote: I found this, but it is not working with sudo, only after sudo su
Code:root@pinebook:/home/pine64# echo 50 > /sys/class/backlight/lcd0/brightness
Okay, now is the question how to make my own xbacklight with -dec 10 and -inc 10 to bind this for keyboard keys
... two scripts , one for key + one for key -
Your script needs to read the value into a variable , add 10 to it , and then write the variable back out; but, only if the +10 will not exceed 100.
Do the same for the minus key binding, only don't allow it to go below say 30 ( idk, experiment ).
also, try: sudo -i
Ok, here are the scripts :
lcd_plus.sh
Code:
#!/bin/bash
LCDVALUE=`cat /sys/class/backlight/lcd0/brightness`
NEWVALUE=$(( $LCDVALUE + 10 ))
if [ $NEWVALUE -le 100 ]
then
echo $NEWVALUE > /sys/class/backlight/lcd0/brightness
echo $NEWVALUE
else
echo $LCDVALUE
fi
lcd_minus.sh
Code:
#!/bin/bash
LCDVALUE=`cat /sys/class/backlight/lcd0/brightness`
NEWVALUE=$(( $LCDVALUE - 10 ))
if [ $NEWVALUE -gt 30 ]
then
echo $NEWVALUE > /sys/class/backlight/lcd0/brightness
echo $NEWVALUE
else
echo $LCDVALUE
fi
try running them with :
sudo -i
./lcd_plus.sh
./lcd_minus.sh
Now all that has to be done in i3 is to bind them to a keysym using exec !
Works well.
Note: of course, you could combine them into a single script and pass a parm (up) or (down)
try it !
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! )