5

When I used OS X there was a shortcut (Cmd+D) that would dismiss the "Do you want to save" dialogue when a window with unsaved changes was closed. Is there an equivalent in Ubuntu and if not is there a way to implement this systemwide?

Save changes dialogue

  • Which program(s)? (probably can't be done system wide as all the programs are devloped separatly) – Wilf Mar 7 '15 at 17:03
  • Picture above is Sublime, which I'm pretty sure you could get a shortcut working in. I'm really after a system wide one. – wjdp Mar 7 '15 at 17:05
6

I have not found a system-wide shortcut (even on OS X, the shortcut may change depending on the application), but there is a way to find the right shortcut for each prompt:

  • When the prompt appears, hold alt and look at the underlined characters (as you would for an application top menu). Of course, we are interested in the "Close without saving" option since in general "Cancel" maps to escape and "Save" maps to enter/space.
  • Use alt+[underlined character] to select the corresponding option (as you would to open a menu in an application). Do not mind upper case.

Alt mode in Sublime Text: alt+w for the 1st option

Alt mode in Sublime Text prompt

Note for those wondering how I could print screen while holding alt: you can either press alt just before the system screenshot is taken, or hold alt from another window of Sublime Text to show underlining (in Sublime Text all windows refer to the same prompt) and then click outside the application to cause a graphical bug that freezes the underlining. I did the latter and used Shutter to take the screenshot.

If the text is "Close without saving", odds are the magic character is w. If it is "Don't save", probably d as in many Mac applications, but not always (see examples below.)

Some applications are also kind enough to active alt mode automatically, i.e. you can see the magic characters underlined from the beginning and just have to type it to choose the option (without holding alt).

Some examples below:

  • Sublime Text: Close Without Saving
  • Text Editor: Close without Saving
  • Inkscape: Close without saving
  • Libre Office: Close without saving (permanent alt mode)
  • ThunderBird: Don't Save
  • Geany: Don't Save (permanent alt mode)
  • Leafpad, Ted: No

Alternatively, you can navigate in the prompt using the left/right arrows and tab/shift+tab, then select the highlighted option with enter/space. However:

  • some applications make you highlight the prompt message when using tab, and the "close without saving" option is on the far left while the default selected "save" is on the far right, meaning you need to use either tab or the arrow keys twice before pressing enter/space. (Ex: Sublime Text)
  • the "Close without saving" option is sometimes on the left, sometimes in the middle, so be careful. With Ted, you even have Yes - No - Cancel in this order.

Therefore I recommend the second method only when dealing with less common prompts such as Ted's, where navigating once to the right is faster than checking the magic character and using it.

Screenshot text: from The Bourgeois Gentleman, new translation by Timothy Mooney

  • Great, 98% of the time Alt+W is going work for me. Cheers hdsandt – wjdp Apr 17 '15 at 17:39
  • This adds to the pile of frustrations about Ubuntu – MikeMurko Mar 18 '16 at 14:46

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.