SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm a Slackware newbie. I install Slackware 14 x64 on a Toshiba L750 laptop. Screen is too bright, can't change it using brightness control (on panel). I'm using KDE.
Last edited by Ipe; 10-22-2012 at 08:18 AM.
Reason: add info
You should be able to change it in KDE using main menu --> System Settings --> Power Management, or if laptop is running on battery you'll see a battery icon in the lower right hand corner, click on it and use the Screen Brightness slider
or you can try this from the console (as root), first 2 commands display the max brightness and brightness levels on my machine, last command sets it to a new value.
Basically, I want to do the same thing in i3wm. I can make keyboard shortcuts in .i3/config, but I don't know what program to call from there. Also, I'd like some indicator of what the current brightness level is in i3bar.
the console command works. thank you dr.s!
But how could i make my setting permanent or default?
i wonder why the Screen Brightness slider in power management
or in the battery monitor not working.
Basically, I want to do the same thing in i3wm. I can make keyboard shortcuts in .i3/config, but I don't know what program to call from there. Also, I'd like some indicator of what the current brightness level is in i3bar.
Thanks.
Here's what I did: First, I read the thread. I originally skimmed over Dr.S's post because I saw "KDE menu" and thought it didn't apply to me. But he basically told me what to do. Only my computer uses "acpi_video0/brightness" between 1-8 rather than "intel_backlight/brightness" between 0 and 4882.
So, I wrote two scripts, bright_up and bright_down:
bright_up
Code:
#! /bin/bash
max_brightness=$(cat /sys/class/backlight/acpi_video0/max_brightness)
brightness=$(cat /sys/class/backlight/acpi_video0/brightness)
if (($brightness<$max_brightness))
then
let brightness=$brightness+1
fi
echo $brightness > /sys/class/backlight/acpi_video0/brightness
bright_down
Code:
#! /bin/bash
max_brightness=$(cat /sys/class/backlight/acpi_video0/max_brightness)
brightness=$(cat /sys/class/backlight/acpi_video0/brightness)
if (($brightness>0))
then
let brightness=$brightness-1
fi
echo $brightness > /sys/class/backlight/acpi_video0/brightness
Then, chmod +x both of those files, and put the following in my .i3/config:
The thing is, my brightness function keys don't work. I need the System 76 driver, and I haven't figured out how to port that over from Ubuntu yet. So, I just used mod+the function keys that should control brightness.
Finally, root owns that brightness file (/sys/class/backlight/acpi_video0/brightness), and you can't chown permanently because the file gets rebuilt every time you boot. So, I put this in my /etc/rc.d/rc.local:
I still haven't figured out how to indicate the brightness level in i3bar. And I know this is probably way too much info for what I actually did, but hopefully the next person can google this and get up and running pretty fast. I tried to lay it all out there.
@DrCube: I think chowning that device to your user is probably not a good idea. Please read up on the "sudo" command, and add the appropriate entries in the /etc/sudoers.conf file.
@DrCube: I think chowning that device to your user is probably not a good idea. Please read up on the "sudo" command, and add the appropriate entries in the /etc/sudoers.conf file.
Please fight my ignorance here, because I don't see how this would work. Can I really use sudo to allow a single program (i3) the ability to edit a single root-owned file (/sys/class/backlight/acpi_video0/brightness)? Without needing a password?
I'm not saying you're wrong, I'm just saying:
1) I don't know how to do it with sudo, and
b) even if I could, it seems more dangerous to elevate i3's privileges than for a user to take ownership of a single, fairly harmless, file.
I don't want my window manager to have any extra privileges that I as a user don't have, except the ability to write to /sys/class/backlight/acpi_video0/brightness.
this thread inspired me to find out how I can control the backlight on my Samsung laptop. The function-keys for the backlight don't work. Thanks to the posting above I found out that
#!/bin/bash
yet=`cat /sys/class/backlight/acpi_video0/actual_brightness`
max=`cat /sys/class/backlight/acpi_video0/max_brightness`
bl_up() {
if [ $yet -lt $max ]; then
let new=$yet+1
echo $new > /sys/class/backlight/acpi_video0/brightness
else
echo "Helligkeit ist schon maximal"
fi
}
bl_down() {
if [ $yet -gt 0 ]; then
let new=$yet-1
echo $new > /sys/class/backlight/acpi_video0/brightness
else
echo "Noch dunkler geht nicht"
fi
}
case "$1" in
'h')
bl_up
;;
'd')
bl_down
;;
'z')
echo "aktuelle Helligkeit $yet von $max"
;;
*)
echo "screen.sh h (heller) | d (dunkler) | z (aktueller Wert)"
esac
which works. But I wanted to configure some keybindings for this. I'm using xmonad as windowmanager. In my ~/.xmonad/xmonad.hs I have added the following two lines:
Please fight my ignorance here, because I don't see how this would work. Can I really use sudo to allow a single program (i3) the ability to edit a single root-owned file (/sys/class/backlight/acpi_video0/brightness)? Without needing a password?
That is EXACTLY what sudo can be setup to achieve. I'm speaking from memory here, but you can setup the sudoers.conf file to say something like :
Allow userx to run "abc def ghi 123" without a password. You can configure it to ask a password, but in this case it would be unhelpful. The sudoers method is far safer than anything else. I work in a large(ish) Unix environment (Solaris servers), and we use sudo to allow lower level users access to commands that would otherwise require root permissions.
@DrCube and @markush, thanks for the script samples!
Quote:
Originally Posted by DrCube
Please fight my ignorance here, because I don't see how this would work. Can I really use sudo to allow a single program (i3) the ability to edit a single root-owned file (/sys/class/backlight/acpi_video0/brightness)? Without needing a password?
I'm not saying you're wrong, I'm just saying:
1) I don't know how to do it with sudo, and
b) even if I could, it seems more dangerous to elevate i3's privileges than for a user to take ownership of a single, fairly harmless, file.
I don't want my window manager to have any extra privileges that I as a user don't have, except the ability to write to /sys/class/backlight/acpi_video0/brightness.
@DrCube, as suggested in Mark's post, you don't need to chown, use something like the following, it will prompt you for a password:
Code:
su -c "echo $brightness > /sys/class/backlight/acpi_video0/brightness"
the console command works. thank you dr.s!
But how could i make my setting permanent or default?
i wonder why the Screen Brightness slider in power management
or in the battery monitor not working.
Not sure about the power management issue on your machine. You can add the command that worked for you to /etc/rc.d/rc.local so it will kick in at startup.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.