简体   繁体   中英

Xmonad: brightness and file permissions

I'm trying to setup my Xmonad to change the back-light intensity on my laptop.

However, to do so, I have to be able to write to the file /sys/class/backlight/intel_backlight/brightness , which requires the application performing the update to be sudoed (all other suggestions I have tried to use to change the back-light intensity seems to "simulate" it by reducing the brightness of the pixels rather than the back-light).

I've written the necessary code to perform this update and tested it using a sudoed ghci instance, however, when I add this to my Xmonad config, I get a permission denied error.

My question is, what are the usual methodologies for giving window managers extra permissions where required? (I'd ideally not want to change the permissions of this file)

I have this in in my sudoers configuration:

# /etc/sudoers.d/brightness-mod
ALL ALL = (ALL) NOPASSWD: /usr/bin/tee /sys/class/backlight/intel_backlight/brightness

This allows you to execute, from user mode, commands like

echo 200 | sudo tee /sys/class/backlight/intel_backlight/brightness

Always use visudo to edit sudoers configuration stuff.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM