[PR #2526] [MERGED] Enable Terminal closing with ALT + F4 and warning of multiple open tabs #24973

Open
opened 2026-01-31 09:06:28 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/2526
Author: @KaiyuWang16
Created: 8/24/2019
Status: Merged
Merged: 9/17/2019
Merged by: @KaiyuWang16

Base: masterHead: dev/kawa/1589-ALT+F4-closing-with-warning-of-multiple-tabs


📝 Commits (10+)

  • ad01d93 ALT+F4 to close the terminal app window and warn user of multiple tabs
  • 6c59bd7 Fix indent issue
  • 6f56942 Indentation issue fix 2
  • 1fb55da add some comments
  • a8515a4 move close window warning texts to resources
  • 42a636b CR feedback changes - 8/28
  • 22de51c fix resource file space issue
  • fa0f859 Fix resource file space issue 2
  • 56dfa07 Fix resource file space issue
  • 1b2d0ca minor CR changes

📊 Changes

5 files changed (+139 additions, -40 deletions)

View changed files

📝 src/cascadia/TerminalApp/App.cpp (+5 -2)
📝 src/cascadia/TerminalApp/AppActionHandlers.cpp (+7 -0)
📝 src/cascadia/TerminalApp/Resources/en-US/Resources.resw (+37 -28)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+84 -10)
📝 src/cascadia/TerminalApp/TerminalPage.h (+6 -0)

📄 Description

Summary of the Pull Request

This PR is for: https://github.com/microsoft/terminal/issues/1589
We add a key binding called "CloseWindow", which will close the whole terminal, and warn the user if multiple tabs are opened. The user could choose to cancel or continue the closing action.

References

PR Checklist

  • Closes #xxx
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

In my Page-App refactoring change: https://github.com/microsoft/terminal/pull/2208, _showDialog's signature is changed. I only pass a ContentDialog to it and the contents are constructed in each specific dialog initialization methods. In this PR, I follow this pattern.

Testing:

  1. check-out this branch and build the project
  2. Start terminal app
  3. Open settings, add
    {
    "command": "closeWindow",
    "keys": [
    "alt+f4"
    ]
    }
    to the end of the "keybindings" list.
  4. Open multiple tabs by clicking "+"
  5. Press alt + F4.
  6. On the dialog, choose ""cancel", then the dialog will close and nothing happens.
  7. Press alt + F4. On the dialog, click "OK". Then the app will close.

image


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/2526 **Author:** [@KaiyuWang16](https://github.com/KaiyuWang16) **Created:** 8/24/2019 **Status:** ✅ Merged **Merged:** 9/17/2019 **Merged by:** [@KaiyuWang16](https://github.com/KaiyuWang16) **Base:** `master` ← **Head:** `dev/kawa/1589-ALT+F4-closing-with-warning-of-multiple-tabs` --- ### 📝 Commits (10+) - [`ad01d93`](https://github.com/microsoft/terminal/commit/ad01d933ceb6a59456eec905a4ea7963bd5bffc4) ALT+F4 to close the terminal app window and warn user of multiple tabs - [`6c59bd7`](https://github.com/microsoft/terminal/commit/6c59bd7e99bba9d83f199d2248945a7e5fc556eb) Fix indent issue - [`6f56942`](https://github.com/microsoft/terminal/commit/6f5694233254ed416aab44f237444e66e03eb891) Indentation issue fix 2 - [`1fb55da`](https://github.com/microsoft/terminal/commit/1fb55daac6c42e3113c9b95d6b343e1b3ca0d369) add some comments - [`a8515a4`](https://github.com/microsoft/terminal/commit/a8515a41eecccdf47f9d042202be5851af7d27b2) move close window warning texts to resources - [`42a636b`](https://github.com/microsoft/terminal/commit/42a636bf9b4d142c8b34ec23f6a22bf00a6c46c6) CR feedback changes - 8/28 - [`22de51c`](https://github.com/microsoft/terminal/commit/22de51c5bb00c37bbce28368bab7d1ed02437653) fix resource file space issue - [`fa0f859`](https://github.com/microsoft/terminal/commit/fa0f859e2eac55bc4447dc2c4f5f0a29ffe47d32) Fix resource file space issue 2 - [`56dfa07`](https://github.com/microsoft/terminal/commit/56dfa07b1b53952fe1342027d3680ba27620f969) Fix resource file space issue - [`1b2d0ca`](https://github.com/microsoft/terminal/commit/1b2d0caf1c148b4ff37b00f226a1f5ac6cb9433e) minor CR changes ### 📊 Changes **5 files changed** (+139 additions, -40 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/App.cpp` (+5 -2) 📝 `src/cascadia/TerminalApp/AppActionHandlers.cpp` (+7 -0) 📝 `src/cascadia/TerminalApp/Resources/en-US/Resources.resw` (+37 -28) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+84 -10) 📝 `src/cascadia/TerminalApp/TerminalPage.h` (+6 -0) </details> ### 📄 Description <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request This PR is for: https://github.com/microsoft/terminal/issues/1589 We add a key binding called "CloseWindow", which will close the whole terminal, and warn the user if multiple tabs are opened. The user could choose to cancel or continue the closing action. <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [ ] Closes #xxx * [ ] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [ ] Requires documentation to be updated * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments In my Page-App refactoring change: https://github.com/microsoft/terminal/pull/2208, _showDialog's signature is changed. I only pass a ContentDialog to it and the contents are constructed in each specific dialog initialization methods. In this PR, I follow this pattern. <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> Testing: 1. check-out this branch and build the project 2. Start terminal app 3. Open settings, add { "command": "closeWindow", "keys": [ "alt+f4" ] } to the end of the "keybindings" list. 3. Open multiple tabs by clicking "+" 4. Press alt + F4. 5. On the dialog, choose ""cancel", then the dialog will close and nothing happens. 6. Press alt + F4. On the dialog, click "OK". Then the app will close. ![image](https://user-images.githubusercontent.com/11893272/64457584-d8fbb080-d0a7-11e9-8fb6-a9f69289fa2c.png) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:06:28 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#24973