3

Possible Duplicate:
How do I modify the power options?

I'd like to shutdown my laptop by closing the lid; but in Power Settings there's no option to do that.

Is there any way to add "shutdown" to the pop-down list in the power settings for "when the lid is closed"? I prefer the way through the terminal without installing a third-party application.

AliNajafies
  • 5,732
  • 4
  • 30
  • 38

1 Answers1

2

Unfortunately, you cannot add this option to the menu, because it is a hard coded list of options. You would have to write a script runs in the background that detects the lid being closed and activates the shutdown automatically.

The command you need (to check to see if the lid is closed is):

cat /proc/acpi/button/lid/LID0/state

Now, I'm no scripting junkie (bash scripting I mean), so maybe someone can edit this and give you a proper answer.

RolandiXor
  • 51,091
  • 31
  • 161
  • 256
  • Thank you Roland for the start point. I'll keep searching. – AliNajafies Sep 15 '12 at 14:36
  • @AliNa: does the answer here: [How do I modify the power options in Ubuntu 11.10?](http://askubuntu.com/q/66723) work for you? – RolandiXor Sep 15 '12 at 14:39
  • Oh, yes :)) this function works properly in 12.04.1. But I guess some others may not work; for example, changing "Windows > Action on title-bar middle-click" doesn't. – AliNajafies Sep 16 '12 at 21:39
  • @AliNa: some features will not work, but I was specifically asking about the shutdown on lid close option. – RolandiXor Sep 16 '12 at 22:51