如何防止电源键直接关闭系统?

Wau*_*uzl 30 acpi

我全新安装了 Ubuntu 13.10。当我按下电源按钮时,我的计算机立即关闭。在 Ubuntu 13.04 中,我有一个不错的菜单,我可以在其中选择要执行的操作。现在它不见了,我想要它回来。这是我/etc/acpi/powerbtn.sh 的粘贴箱。

我已经做了

gsettings set org.gnome.settings-daemon.plugins.power button-WORD 'interactive'
Run Code Online (Sandbox Code Playgroud)

这里WORDhibernatepowersleepsuspend

jer*_*ija 38

检查您的/etc/systemd/logind.conf文件。它应该是这样的:

[Login]
#NAutoVTs=6
#ReserveVT=6
#KillUserProcesses=no
#KillOnlyUsers=
#KillExcludeUsers=root
#Controllers=
#ResetControllers=cpu
#InhibitDelayMaxSec=5
#HandlePowerKey=poweroff
#HandleSuspendKey=suspend
#HandleHibernateKey=hibernate
#HandleLidSwitch=suspend
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#IdleAction=ignore
#IdleActionSec=30min
Run Code Online (Sandbox Code Playgroud)

取消注释该行#HandlePowerKey=poweroff并将值更改为ignore

然后使用以下命令重新启动登录:sudo systemctl restart systemd-logind或重新启动计算机。

编辑:如何创建新的 acpi 处理程序/etc/acpi/events/. 文件的内容应该是:

event=<acpi_event_code>
action=<script_to_call>
Run Code Online (Sandbox Code Playgroud)

<acpi_event_code>您使用该acpi_listen工具获得的代码在哪里,以及<script_to_call>您希望在该事件发生时调用的脚本的完整路径。

他们一定在 13.10 中更改了某些内容,因为与 13.04 相比,我的 /etc/accpi/events 文件夹中的文件似乎太少了。