Ubuntu – Can anyone advise of a way to set a universal quit-application shortcut

gnomeshortcut-keys

I'm moving across from Mac OSX and am quite used to using the Cmd-Q shortcut to quit apps. I appreciate that Linux is set up differently and that different apps have different shortcuts for quitting (e.g. some use Ctrl-Q while others might be Alt-Q, etc.). I'm currently using Ubuntu GNOME.

Would it be possible to create a standard keyboard shortcut for quitting all apps easily and safely in Ubuntu? I'm happy to use a third-party tool or do a bit of further digging.

M

Best Answer

Gracefully close a window

The simplest would be to add the following command to a shortcut key of your choice:

wmctrl -c :ACTIVE:

wmctrl is not installed by default:

sudo apt-get install wmctrl

from man wmctrl:

-c <WIN>
    Close the window <WIN> gracefully

Gracefully closing a window means that if you e.g. made changes to the currently opened file, you will be asked if you want to save the changes etc. This is similar to the Cmnd + Qyou are used to.

To add it to a shortcut key

Choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command:

wmctrl -c :ACTIVE:

Or, if you are comfortable with Alt + F4

Even much simpler, as mentioned by @Takkat (thanks!), you can simply press Alt + F4

Related Question