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

What's the best/right way to configure GNOME/Unity so that hitting ALT + F4 will Power Off the system when no more windows are open? (pop up the Power-Off dialog).

(running Ubuntu 12.04.1)

share|improve this question
You want to do it only when there are no windows open? – Seth Jan 2 '13 at 3:39
up vote 1 down vote accepted

No.There is no short-cut for Power-off. But you could add one.

Go to System Settings ----> Keyboard -----> Click on the shortcuts tab ----> Click on the + button.

Now enter some name of the shortcut and the command gnome-session-quit --power-off --force.

Now you can apply whatever keyboard shortcut you want to it. Click on the word that says Disabled... when you click New accelerator... will be shown. Now you assign it to whatever keyboard shortcut you want to it (that is by pressing Alt + F4 when you see the word New accelerator...)

share|improve this answer
Well, that works, but it tells me "this shortcut is already in use and setting a new command would overwrite the current" (which is close-window for alt+f4) .. Is there a way to have it hierarchical, as in Xfce etc., so it only triggers the session-quit when no windows are opened? Else: Accepted answer! – isync Jan 2 '13 at 1:35
I’m not sure if there is any way to have it hierarchical. – Mukund Jan 2 '13 at 6:33
So there's no way to replicate behaviour of Xfce, Windows, et al. Well, thanks anyway --acepted as best answer. – isync Jan 3 '13 at 23:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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