Skip to content

macOS: restore some menu shortcuts when terminal is not focused#12522

Open
bo2themax wants to merge 7 commits intoghostty-org:mainfrom
bo2themax:d10efd73
Open

macOS: restore some menu shortcuts when terminal is not focused#12522
bo2themax wants to merge 7 commits intoghostty-org:mainfrom
bo2themax:d10efd73

Conversation

@bo2themax
Copy link
Copy Markdown
Member

@bo2themax bo2themax commented Apr 29, 2026

This fixes #10749.

After a few iterations for the past few weeks, this is the minimal change I can think of to fix this issue without introducing changes from the core layer.

As the issue says, the rc here is that we strip the shortcuts from the menu in order to prevent menu bar handling some of the key equivalents. I did try to revert this behavior, but that would involve a lot of regression testing (which I did). I'm still not 99.999% sure that would not breaking anything else, so those branches will stay in my local branch for now.

  1. Add back the shortcuts to copy, paste, select all, undo and redo
  2. Restore them when ever the first responder changes or the key window changes, so the menu can handle them again in native views. See the comments in restoreRegisteredMenusIfNeeded for all the native views i found that had this issue before.
  3. Add back cut menu and disable whenever a terminal surface is focused.
Screen.Recording.2026-04-29.at.22.14.05.mp4

@bo2themax bo2themax requested a review from a team as a code owner April 29, 2026 20:25
@ghostty-bot ghostty-bot Bot added the os/macos label Apr 29, 2026
@bo2themax bo2themax mentioned this pull request Apr 29, 2026
@bo2themax
Copy link
Copy Markdown
Member Author

bo2themax commented Apr 30, 2026

  • There should be some optimization around re-sync, right now it doesn't track ghostty actions for restorable items

  • Also check whether reloading config would affect anything

Copy link
Copy Markdown
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conceptually this is totally fine, I came upon the same solution. Stylistically I think this needs to be cleaned up a bit. I feel like we could better organize some of this.

Comment thread macos/Sources/Ghostty/Ghostty.Config.swift Outdated
@bo2themax bo2themax force-pushed the d10efd73 branch 2 times, most recently from c6e5de3 to cc9e7f9 Compare May 3, 2026 07:59
@bo2themax
Copy link
Copy Markdown
Member Author

Conceptually this is totally fine, I came upon the same solution. Stylistically I think this needs to be cleaned up a bit. I feel like we could better organize some of this.

1cbf728 changed the manual signal to one-time setup for first responder on key window. I hope that's what you meant, I don't want to over engineer the changes in MenuShortcutManager

@bo2themax bo2themax requested a review from mitchellh May 6, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS: Not possible to cmd+c/cmd+x from rename tab, search, other text fields

2 participants