Skip to content

Support native MacOS shortcuts to move to beginning and end of window - #10003

Merged
mitchellh merged 3 commits into
ghostty-org:mainfrom
yasuf:feature/standard-mac-bindings
Dec 22, 2025
Merged

mitchellh merged 3 commits into
ghostty-org:mainfrom
yasuf:feature/standard-mac-bindings

Conversation

@yasuf

@yasuf yasuf commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

Adds support to scroll to the top or bottom of the window by using macOS native shortcuts, testing in video.

AI disclaimer: AI used to explore solutions, tested and edited solution proposed by Opus 4.5

testing_macos_3.mov

@yasuf
yasuf requested a review from a team as a code owner December 22, 2025 02:45
@yasuf yasuf changed the title Support native MacOS shortcuts to move to beginning and end of document Support native MacOS shortcuts to move to beginning and end of window Dec 22, 2025
@yasuf

yasuf commented Dec 22, 2025

Copy link
Copy Markdown
Contributor Author

the command history doesn't scroll back when I tested so I think we're OK as-is without preventing the event from being sent to Ghostty.

For the page navigation when I do fn + up or fn + down the command history scrolls, that's the main reason why I didn't include that in this PR, the full switch looked like this:

        // Process MacOS native scroll events
        switch selector {
        case #selector(moveToBeginningOfDocument(_:)):
            _ = surfaceModel.perform(action: "scroll_to_top")
        case #selector(moveToEndOfDocument(_:)):
            _ = surfaceModel.perform(action: "scroll_to_bottom")
		case #selector(scrollPageUp(_:)):
            _ = surfaceModel.perform(action: "scroll_page_up")
		case #selector(scrollPageDown(_:)):
            _ = surfaceModel.perform(action: "scroll_page_down")
        default:
            break
        }

@yasuf

yasuf commented Dec 22, 2025

Copy link
Copy Markdown
Contributor Author

This is part of #2526

@bo2themax bo2themax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me, only a small suggestion

Comment thread macos/Sources/Ghostty/SurfaceView_AppKit.swift Outdated
@mitchellh
mitchellh merged commit 81b0242 into ghostty-org:main Dec 22, 2025
53 checks passed
@mitchellh mitchellh added this to the 1.3.0 milestone Dec 22, 2025
mitchellh added a commit that referenced this pull request Apr 12, 2026
Fix: #11989
Cause identified to: ab352b5
Original PR: #10003
Problem: I don't think it is OK to hard code the keybind like this at
all. Ghostty's config is flexible enough to achieve this.
Proposal: Revert the above commit via this PR.

@yasuf @bo2themax
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.

3 participants