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

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

Original Pull Request: https://github.com/microsoft/terminal/pull/2526

State: closed
Merged: Yes


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

**Original Pull Request:** https://github.com/microsoft/terminal/pull/2526 **State:** closed **Merged:** Yes --- <!-- 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)
claunia added the pull-request label 2026-01-31 09:06:30 +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#24978