简体   繁体   English

Xmonad:亮度和文件权限

[英]Xmonad: brightness and file permissions

I'm trying to setup my Xmonad to change the back-light intensity on my laptop. 我正在尝试设置Xmonad来更改笔记本电脑上的背光强度。

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). 但是,要做到这一点,我必须能够写入文件/sys/class/backlight/intel_backlight/brightness ,这要求执行更新的应用程序被伪装(我尝试过使用的所有其他建议来改变背景-光强度似乎通过降低像素而不是背光的亮度来“模拟”。

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. 我已经编写了执行此更新所需的代码,并使用了一个经过处理的ghci实例对其进行了测试,但是,当我将其添加到Xmonad配置中时,出现权限被拒绝的错误。

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: 我在sudoers配置中有这个:

# /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. 始终使用visudo编辑sudoers配置内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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