Linux Backlight – Control Backlight as a User Without xbacklight

backlightlinuxwaylandxorg

I'm working on Gentoo and Intel modesetting driver for my video card. That's why xbacklight isn't working.

I can write inside /sys/class/backlight… whith a root acount but that's not what I want to.
I saw somebody using dbus-send and HAL, but seems like HAL isn't on Gentoo (well there is hal-flash).
So I was wondering about a nice solution to control my backlight.

Oh wait, I just remembered xrandr. Is that the only option available for me? If there is a solution for both xorg and wayland that could be nice.

EDIT : It seems that xrandr donesn't modify /sys/class/backlight… and I think this mean that it doesn't affect the battery charge.

Best Answer

You can give yourself the permission to write to /sys/class/backlight/*, or add a sudo rule to modify the file. That's what I did when I had a computer with an i915 GPU.

For example, add something like the following code to /etc/rc.local:

chgrp -R backlighters /sys/class/backlight
chmod g+w /sys/class/backlight/*/*

and add yourself to the backlighters group. If you want to give the permission to the user who's logged in on the console, that's harder, I think you'd have to hook into polkit and even then it's awkward because sysfs doesn't support ACL.

Related Question