2

Coming from Windows, I am very accustomed to the very common "save changes" modal dialog providing a "yes/no/cancel" option with "Y" and "N" being provided as keyboard accelerators (shortcut keys).

On Linux, I will often try to close an unsaved document and then dismiss the dialog by typing "N"-- but this doesn't work. Not only is the paradigm different ("close without saving" vs "no") but there never appear to be any accelerators.

I have tried in Sublime Text:

enter image description here

Pluma:

enter image description here

Gedit:

enter image description here

LibreOffice Writer:

enter image description here

Is this the normal paradigm for this type of dialog on Linux? What are its origins? is it a dialog provided by GTK?

For a very common dialog, I find it to be very unfriendly. I have to instead use tab to step through which button is focused. And this isn't always obvious depending on the theme used.

And why are there no accelerators? Are they unsupported in modal dialogs?

I am trying to familiarize myself with the common modal paradigm (for GTK at least) so that I don't have to think about it and just queue up my actions entirely from the keyboard. For this sample set, it seems as though "tab, enter" is the way to dismiss and close without saving.


I find it interesting that Sublime Text uses the expected "Yes/No/Cancel" dialog on Windows and the "Close without saving/Cancel/Save" dialog on Linux (like other applications there). I suspect that this would have had to have been an active decision.

3 Answers 3

4

This dialog is indeed provided by Gtk.

It does have accelerators; they aren’t indicated by default, but if you hold Alt down you’ll see them. In Gedit, they’re w for “Close without Saving”, c for “Cancel”, and s for “Save As...” You can also use Esc to cancel, and Enter to save.

4
  • Wonderful! I suspect that being GTK that there is no option to enable them by default for modal dialogs? I understand that this isn't Windows so I shouldn't expect the same behavior.
    – Zhro
    Sep 13, 2019 at 21:54
  • In the case of LibreOffice Writer, I found the accelerator to be d for "Don't Save". So much for accelerator consistency. At least tab-enter is consistent in this case.
    – Zhro
    Sep 13, 2019 at 23:34
  • 1
    They’re enabled by default, just not indicated by default. Sep 14, 2019 at 7:16
  • To clarify, I can't actually use the accelerators without holding down alt. I am partial to the Windows paradigm which both displays and enables them without having to hold the alt key first for modal dialogs.
    – Zhro
    Sep 14, 2019 at 15:35
3

I believe GTK/GNOME borrows quite a bit of its human interface design guidelines from the Apple macOS and its ancestors.

I think Mac had quite strong design rules for its dialog windows:

  • Enter would always be the accelerator for "do the default/safe thing", i.e. Save or Save As... in your examples, sort of an "universal affirmative". The thicker boundary on the Save/Save As buttons is the hint that this is the case.
  • Esc would always be the "stop, I don't want this after all" button, invoking the equivalent of "Cancel" in your examples. In other words, the "universal negative" accelerator.
  • ..and since the "close without saving" is the destructive option (it causes data to be lost), it actually should be harder to choose than the others. So it won't get either of the universal accelerators.

You might want to read the classic Macintosh Human Interface Guidelines document, or at least the parts relating to dialog boxes (Feedback and Dialog starting on page 33 of the PDF, and the entire Chapter 6 on dialog boxes, starting on page 199.) Although GTK has made certain modifications, this old document is a very clear description of the kind of design philosophy the UI designers might be aiming for.

GNOME has its own Human Interface Guidelines also. In particular, it explicitly defines that accelerators (known as access keys in their terminology) are only indicated when Alt is held down.

1
  • Thank you for the citation to the GNOME Human Interface Guidelines. There does seem to be a mix of Apple and Windows philosophies in Linux desktop environments. I've always considered GNOME to be closer to Windows and KDE to be adhere closer to Mac. I can see that this isn't always the case.
    – Zhro
    Sep 15, 2019 at 10:44
0

Concerning origins I give some examples from a classic unix editor "vi" (and "vim").

In vim, after the "quit" command "q":

   E37: No write since last change (add ! to override)

This shows up on a red (!) bottom line. Now you have to make up your mind if you want to q! (really quit your unnamed "buffer" - there is no file yet), or w my file (write as file 'my file' (w! my file overwrites)) and then q. Or just continue - it's not modal, just a line that disappears.

(with an existing file it is wq to save to the existing file, followed by quit)

In the even more classic "vi" (1976 (!) says wikipedia):

No write since last change (:quit! overrides) 

No indication here that q means quit. You find it in man ex.

quit abbr: q
         Causes ex to terminate.  No automatic write of the editor buffer
         to a file is performed.  However, ex issues a warning message [...]

Or in vim, after h[elp] quit

:q[uit]      Quit the current window.  Quit Vim if this is the last
             window.  This fails when changes have been made [...]

And a Control-C gives (on vim again):

Type  :qa!  and press <Enter> to abandon all changes and exit Vim

If you read this the first time it feels like a badly formatted insult: Type "qa", you idiot. What it really means is: semicolon for command mode, qa for quit all files/windows and "!" to force the quit.

Leaving an editor has never been simple -- can't even be. Your examples demonstrate that, too.

I am glad the first answer (Alt key to show) solves the main problem.

The "save (as)(...)" button itself also is very inconsistent: sublime and libreoffice seem to write directly to the "New" file or "Untitled 1" document. Pluma is missing the dots! Oh I see: it's called "Unsaved Document 1", so of course "save as" means "save as..." and not "save as is". Who would want a paradoxon like that in his folder?

I want to say: you really can't call "linux" unfriendly. Everybody is trying hard to set up a useful desktop environment in a GUI running on linux.

queue up my actions entirely from the keyboard.

hmm it sounds as if you might like using vim in a terminal ;)

Now I will see if I can't make my vim more friendly. It really shouldn't be on a red-background error line...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .