Skip to content

enhance: close all windows with ESC #1509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

NathanBaulch
Copy link
Contributor

My muscle memory expects dialogs to be easily dismissed with ESC, so it's quite jarring when it doesn't work.
This PR ensures all chromeless windows close when escape is pressed.

@love-linger
Copy link
Collaborator

I do not like this PR. ESC should only close toolbox windows (normally a modal dialog). Windows like File Histories, Blame, Branch Compare and Dir Histories should not use ESC to close.

@NathanBaulch
Copy link
Contributor Author

AFAIK none of these windows have unsaved state that the user needs to commit, so what's the risk of providing a quick dismiss option? Nothing is lost if the user accidentally hits ESC.

@love-linger
Copy link
Collaborator

This has nothing to do with the content displayed within the window, but only with the window's own displaying mode.

Usually, if a window is independent of another window, has Minimize and Maximize buttons, and has Actived and Deactived states, the ESC key will not be used to close the window.

For example: on macOS, we use system caption buttons instead of the custom CaptionButtons view. When pressed the green button, the window will be changed to full-screen mode. And then user restore it using ESC key.

@NathanBaulch
Copy link
Contributor Author

I've never used macOS and have never seen ESC used to restore a maximized window in Linux or Windows, so perhaps that's the reason for my disconnect here.

@goran-w
Copy link
Contributor

goran-w commented Jul 5, 2025

In that case, let's use ESC for these windows on Windows/Linux but not on Mac. I'm on Windows and am also very much used to these kinds of programs conveniently using ESC in all "spawned" (and stateless) windows except for the very top-level one (i.e the SourceGit main window).

@love-linger
Copy link
Collaborator

Have you really encountered windows that can be closed using the ESC key when it matches following rules:

  • Has minimized, maximized and restore buttons
  • Can be resized
  • Has Actived and Deactived states

@gadfly3173
Copy link
Contributor

Wireshark’s Preferences window adheres to this rule. However, even if you minimize this window, the main window remains disabled until the Preferences window is closed. However, it's more common to treat such pop-up windows like blame, history, etc., as dialog boxes—with only a close button—while still being standalone windows.

image

@love-linger
Copy link
Collaborator

love-linger commented Jul 5, 2025 via email

@goran-w
Copy link
Contributor

goran-w commented Jul 5, 2025

The WinMerge tool offers several modes for this, in a single combo-box. As a frequent user of that tool, I find this flexibility awesome - it even allows (optionally) closing the main window with ESC. (It's using an MDI model, but the MDI windows are tileable & resizable and have min/max-imize and close buttons.)

image

image

NOTE: There's no real need to handle this differently in SourceGit on Mac - instead, this feature could be optional (in global Preferences) and disabled by default!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants