如何指定电源按钮执行“shutdown -h now”而不是图形关机菜单?

719*_*016 10 shortcut-keys 11.10

我想指定当我按下笔记本电脑中的电源按钮时,会发送“shutdown -h now”命令,而不是调出图形关机菜单。我如何在 Ubuntu 11.10 上做到这一点?

Oli*_*Oli 16

这很简单。当您按下电源按钮时,一个 ACPI 事件会在/etc/acpi/powerbtn.sh.

您可以编辑它shutdown -h now作为第一件事运行,所以它看起来像:

#!/bin/sh
# /etc/acpi/powerbtn.sh
# Initiates a shutdown when the power putton has been
# pressed.

/sbin/shutdown -h now "Power button pressed"
exit 0

# leave the old code below (in case you want to revert!)
Run Code Online (Sandbox Code Playgroud)