我的键盘上有一个电源键,我想在按下脚本时运行它。
我环顾四周,没有在上面发现任何东西,因为我看到的是,人们总是对logind.conf提供的东西感到满意,以下是man logind.conf的有趣之处:
HandlePowerKey=, HandleSuspendKey=, HandleHibernateKey=, HandleLidSwitch=, HandleLidSwitchDocked=
Controls how logind shall handle the system power and sleep keys and the lid switch to trigger actions such as system power-off or suspend. Can be one of "ignore", "poweroff", "reboot", "halt", "kexec", "suspend", "hibernate", "hybrid-sleep", and "lock". If "ignore", logind will never handle these keys. If
"lock", all running sessions will be screen-locked; otherwise, the specified action will be taken in the respective event. Only input devices with the
"power-switch" udev tag will be watched for key/lid switch events. HandlePowerKey= defaults to "poweroff". HandleSuspendKey= and HandleLidSwitch= default to
"suspend". HandleLidSwitchDocked= defaults to "ignore". HandleHibernateKey= defaults to "hibernate". If the system is inserted in a docking station, or if
more than one display is connected, the action specified by HandleLidSwitchDocked= occurs; otherwise the HandleLidSwitch= action occurs.
A different application may disable logind's handling of system power and sleep keys and the lid switch by taking a low-level inhibitor lock
("handle-power-key", "handle-suspend-key", "handle-hibernate-key", "handle-lid-switch"). This is most commonly used by graphical desktop environments to take
over suspend and hibernation handling, and to use their own configuration mechanisms. If a low-level inhibitor lock is taken, logind will not take any action
when that key or switch is triggered and the Handle*= settings are irrelevant.我没有在代码块中设置粗体文本(也没有使用引号块,因为它将所有内容都放在一行中,然后它显然是不可读的),然后在这里重复一个有趣的部分:
控制logind应如何处理系统电源和睡眠键以及盖子开关,以触发系统断电或暂停等操作。可以是“忽略”、“断电”、“重新启动”、“停止”、"kexec“、”暂停“、"hibernate”、“混合睡眠”和“锁”。
还是我走错了路,这只是为了键盘键,而不是电源按钮?
在任何情况下,在以前,使用acpi很容易,只需替换/usr/lib/acpid/中的power_button脚本就可以了,对于systemd,难道没有什么等价的东西吗?
谢谢。
PS:如何更改电源按钮关闭操作以在系统d下运行脚本在评论中建议不回答我的问题,因为我回答这个问题是为了管理键盘上的电源键,而不是电源按钮。
发布于 2020-02-11 14:55:06
我没有看到这个问题不再是set复制,于是我打开了另一个问题,我找到了一个答案(至少对于openbox ),因为我不知道如何设置重复,所以我只是把这个链接放在这里:https://unix.stackexchange.com/a/566910/390900
https://unix.stackexchange.com/questions/562575
复制相似问题