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)

  • You want to do it only when there are no windows open? – Seth Jan 2 '13 at 3:39

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...)

| 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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