Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

marked as duplicate by Florian Diesch, Tom Brossman, Jorge Castro, RolandiXor, fossfreedom Sep 18 '12 at 16:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

possible duplicate: – green Sep 14 '12 at 7:53
up vote 2 down vote accepted

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.

share|improve this answer
Thank you Roland for the start point. I'll keep searching. – AliNa Sep 15 '12 at 14:36
@AliNa: does the answer here: How do I modify the power options in Ubuntu 11.10? 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. – AliNa 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

Not the answer you're looking for? Browse other questions tagged or ask your own question.