![]() |
How to Configure Screen Brightness in mate on pinebook via terinal? - Printable Version +- PINE64 (https://forum.pine64.org) +-- Forum: Pinebook (https://forum.pine64.org/forumdisplay.php?fid=76) +--- Forum: Linux on Pinebook (https://forum.pine64.org/forumdisplay.php?fid=79) +--- Thread: How to Configure Screen Brightness in mate on pinebook via terinal? (/showthread.php?tid=5062) |
How to Configure Screen Brightness in mate on pinebook via terinal? - shirman - 08-31-2017 I'm trying to bind brightness change to buttons via terminal in i3, but I can't find a command that will doing that: Code: pine64@pinebook:~$ sudo xrandr --listmonitors Output is: xrandr: Failed to get size of gamma for output default Monitors: 1 0: +*default 1366/361x768/203+0+0 default So, when I trying to change it like: Code: pine64@pinebook:~$ sudo xrandr --output default --brightness 0.5 It isn't do anything. Code: pine64@pinebook:~$ echo 240 > /sys/class/backlight/lcd0/brightness Have not do anything too ![]() RE: How to Configure Screen Brightness in mate on pinebook via terinal? - shirman - 08-31-2017 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 ![]() RE: How to Configure Screen Brightness in mate on pinebook via terinal? - MarkHaysHarris777 - 08-31-2017 (08-31-2017, 12:28 PM)shirman Wrote: I found this, but it is not working with sudo, only after sudo su ... 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 lcd_minus.sh Code: #!/bin/bash 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 ! RE: How to Configure Screen Brightness in mate on pinebook via terinal? - MarkHaysHarris777 - 08-31-2017 Ok, expanding on a theme, I have combined the scripts here into one script that takes two parameters; the first is the direction ( U for up; D for down ) and the second is the scalar value. lcd_bright.sh Code: #!/bin/bash Run the script with : sudo -i ./lcd_bright.sh U 10 or ./lcd_bright.sh D 10 Notes: The U and D can be upper or lower case ( the script upper cases it for you ). The script might be changed to set a maximum or minimum based on parameter-- try it ! ![]() RE: How to Configure Screen Brightness in mate on pinebook via terinal? - shirman - 08-31-2017 Thank you a lot ![]() Even without "sudo -i" after "sudo chown pine64: brightness" command ![]() RE: How to Configure Screen Brightness in mate on pinebook via terinal? - MarkHaysHarris777 - 08-31-2017 Excellent dude! ![]() I got my bindings to work too, in i3, with bindsym(s) in ~/.config/i3/config ... but first I created a group called gpio_pins, to give permissions to write to the file brightness, and added my pine64 user to the group! Also, I added a rule to my sudoers configuration ( use visudo ) similar to this: # my extra rules Cmnd_Alias LCDBRIGHT=/usr/local/sbin/lcd_bright.sh ALL ALL=NOPASSWD: LCDBRIGHT Then in ~/.config/i3/config I added a bindsym near the bottom: bindsym $mod+Shift+u exec sudo lcd_bright.sh u 10 bindsym $mod+Shift+d exec sudo lcd_bright.sh d 10 Then, restart i3 with mod+Shift+r ... now mod+Shift+u turns up the brightness, and mod+Shift+d turns down the brightness. nice ![]() RE: How to Configure Screen Brightness in mate on pinebook via terinal? - mikee3000 - 12-02-2018 Thank you for the great advice @MarkHaysHarris777! To get this work on my Pinebook (1080p - Arch image with i3) I had to change the file from /sys/class/backlight/lcd0/brightness to /sys/class/backlight/backlight/brightness, the top value from 100 to 10 and the stepping to single digits. I'm not sure if this is due to the hardware or the os or both. To get the max possible value: `cat /sys/class/backlight/backlight/max_brightness` The script to raise the brightness then looks like this: Code: #!/bin/bash and the one to decrease it (careful - this can completely dim the screen when the value gets to 0): Code: #!/bin/bash More info: https://wiki.archlinux.org/index.php/backlight |