Repository navigation
Adds support for shortcut passthrough to browser #4724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jcrsilva
wants to merge
5
commits into
manaflow-ai:main
Choose a base branch
from
jcrsilva:feature/keyboard_passthrough
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
75bda6c
Adds support for shortcut passthrough to browser
jcrsilva f05cbbb
Fix bot feedback
jcrsilva b59fda5
Fix more feedback
jcrsilva feb67a9
Cache parsed shortcut-passthrough hosts to avoid reparsing on every k…
jcrsilva 2a5fd3c
Sync swift-file-length-budget.tsv to post-rebase actuals
jcrsilva File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import AppKit | ||
|
|
||
| /// Per-URL Cmd-modifier passthrough for the embedded browser pane. | ||
| /// | ||
| /// When the focused browser pane's URL matches the user-configured | ||
| /// `browser.shortcutPassthroughHosts` allowlist, Cmd-modifier key equivalents | ||
| /// should be handed off to the web content instead of being claimed by cmux's | ||
| /// main menu. This is the seam that lets VS Code (running in code-server | ||
| /// inside the embedded browser) receive Cmd+P, Cmd+Shift+P, Cmd+F, Cmd+B, | ||
| /// Cmd+D, etc. | ||
| /// | ||
| /// Default behavior (empty allowlist) is unchanged. When a chord is forwarded | ||
| /// but the page does NOT consume it (e.g. Cmd+Q has no JS handler), callers | ||
| /// fall back to AppKit's standard menu dispatch so system shortcuts still work. | ||
| /// | ||
| /// `@MainActor` on the function (not just the body) gives compile-time | ||
| /// guarantees that callers are on the main actor, instead of only the runtime | ||
| /// trap from `MainActor.assumeIsolated`. The function takes a plain `URL?` | ||
| /// rather than a `WKWebView` reference so tests can exercise the policy | ||
| /// without instantiating a web view. | ||
| @MainActor | ||
| func shouldPassthroughCommandEquivalentToWebContent( | ||
| _ event: NSEvent, | ||
| responder: NSResponder? = nil, | ||
| url: URL?, | ||
| defaults: UserDefaults = .standard | ||
| ) -> Bool { | ||
| let flags = event.modifierFlags.intersection(.deviceIndependentFlagsMask) | ||
| guard flags.contains(.command) else { return false } | ||
|
|
||
| if cmuxIsLikelyWebInspectorResponder(responder) { | ||
| return false | ||
| } | ||
|
|
||
| return BrowserLinkOpenSettings.urlMatchesShortcutPassthrough(url, defaults: defaults) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.