Skip to content

terminal: Bind Alt+F4 to Close Window in the terminal keymap#53091

Merged
kubkon merged 2 commits intozed-industries:mainfrom
SAKETH11111:terminal-alt-f4-close
Apr 27, 2026
Merged

terminal: Bind Alt+F4 to Close Window in the terminal keymap#53091
kubkon merged 2 commits intozed-industries:mainfrom
SAKETH11111:terminal-alt-f4-close

Conversation

@SAKETH11111
Copy link
Copy Markdown
Contributor

@SAKETH11111 SAKETH11111 commented Apr 3, 2026

Closes #52774

Summary

  • Bind Windows Alt+F4 to workspace::CloseWindow in the Terminal keymap context
  • Add a regression test covering the built-in Windows terminal keymap entry

Why

When the integrated terminal is focused, Alt+F4 should close the window instead of falling through to terminal keystroke handling. Handling this in the Windows Terminal keymap keeps the fix aligned with the rest of the terminal shortcut overrides.

Validation

  • cargo test -p settings windows_terminal_keymap_closes_window_on_alt_f4

Release Notes:

  • Fixed Alt+F4 on Windows so Zed closes even when the integrated terminal is focused.

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Apr 3, 2026
@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Apr 3, 2026
@SAKETH11111 SAKETH11111 marked this pull request as ready for review April 3, 2026 19:42
@zed-codeowner-coordinator zed-codeowner-coordinator Bot requested review from a team, JosephTLyons and as-cii and removed request for a team April 3, 2026 19:42
@injust
Copy link
Copy Markdown
Contributor

injust commented Apr 3, 2026

Looks like you have an unrelated commit in your branch?

Also, is it possible to just do this using a default keybind in the Terminal context?

@SAKETH11111 SAKETH11111 force-pushed the terminal-alt-f4-close branch from 3d2bda1 to 6822387 Compare April 3, 2026 22:24
@SAKETH11111 SAKETH11111 changed the title terminal_view: Allow Alt+F4 to close the window terminal: Bind Alt+F4 to Close Window in the terminal keymap Apr 3, 2026
@SAKETH11111
Copy link
Copy Markdown
Contributor Author

Thanks for calling both of these out. I rebased the branch onto main to remove the unrelated commit, and I reworked the fix to use the Windows Terminal keymap context instead of special-casing TerminalView. The PR now binds Alt+F4 to workspace::CloseWindow in that context and adds a regression test that checks the built-in Windows keymap entry. Validation: cargo test -p settings windows_terminal_keymap_closes_window_on_alt_f4.

@SomeoneToIgnore
Copy link
Copy Markdown
Contributor

Also passing by and noting that crates/settings/src/keymap_file.rs is somewhat odd, we do not have other tests like these and do not seem to need one.

I'll leave the decision about the binding to @\reflectronic .

@kubkon
Copy link
Copy Markdown
Member

kubkon commented Apr 27, 2026

Also passing by and noting that crates/settings/src/keymap_file.rs is somewhat odd, we do not have other tests like these and do not seem to need one.

I'll leave the decision about the binding to @\reflectronic .

Agreed about the test - removed. The binding looks fine to me tho.

@kubkon kubkon enabled auto-merge April 27, 2026 09:18
@kubkon kubkon added this pull request to the merge queue Apr 27, 2026
Merged via the queue into zed-industries:main with commit 2b29d00 Apr 27, 2026
31 checks passed
tomhoule pushed a commit that referenced this pull request Apr 27, 2026
Closes #52774

## Summary
- Bind Windows `Alt+F4` to `workspace::CloseWindow` in the `Terminal`
keymap context
- Add a regression test covering the built-in Windows terminal keymap
entry

## Why
When the integrated terminal is focused, `Alt+F4` should close the
window instead of falling through to terminal keystroke handling.
Handling this in the Windows `Terminal` keymap keeps the fix aligned
with the rest of the terminal shortcut overrides.

## Validation
- `cargo test -p settings
windows_terminal_keymap_closes_window_on_alt_f4`

Release Notes:

- Fixed Alt+F4 on Windows so Zed closes even when the integrated
terminal is focused.

---------

Co-authored-by: Jakub Konka <[email protected]>
ebaah46 pushed a commit to ebaah46/zed that referenced this pull request May 6, 2026
…ustries#53091)

Closes zed-industries#52774

## Summary
- Bind Windows `Alt+F4` to `workspace::CloseWindow` in the `Terminal`
keymap context
- Add a regression test covering the built-in Windows terminal keymap
entry

## Why
When the integrated terminal is focused, `Alt+F4` should close the
window instead of falling through to terminal keystroke handling.
Handling this in the Windows `Terminal` keymap keeps the fix aligned
with the rest of the terminal shortcut overrides.

## Validation
- `cargo test -p settings
windows_terminal_keymap_closes_window_on_alt_f4`

Release Notes:

- Fixed Alt+F4 on Windows so Zed closes even when the integrated
terminal is focused.

---------

Co-authored-by: Jakub Konka <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alt+f4 not working when the focus is on the terminal buffer

7 participants