-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix Cloud sidebar shortcut and customize right sidebar tabs #11950
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9dc605b
test: right-sidebar digit shortcuts should follow visible tab positions
lawrencecchen b13fdc4
Right sidebar: customizable tabs and positional digit shortcuts
lawrencecchen bc99270
Rebuild shortcut matcher snapshots after installing the default-strok…
lawrencecchen ff99843
Right sidebar: drag a mode-bar pill to reorder tabs inline
lawrencecchen 59c0c4f
fix(sidebar): refresh gated shortcuts and preserve visible tab
lawrencecchen 37e26cb
fix(sidebar): remove duplicate defaults observer
lawrencecchen 518b173
fix settings shortcut override synchronization
lawrencecchen 4b93b37
inject host-scoped shortcut defaults
lawrencecchen 7e841b3
test: update sidebar shortcut snapshot count
lawrencecchen f6bcab4
fix sidebar settings refresh and accessibility
lawrencecchen 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
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
36 changes: 36 additions & 0 deletions
36
Packages/macOS/CmuxSettings/Sources/CmuxSettings/Values/ShortcutDefaultResolver.swift
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 @@ | ||
| /// Resolves host-specific shortcut defaults without shared mutable state. | ||
| /// | ||
| /// The settings package owns the built-in table, but a host may have a more | ||
| /// specific default. For example, cmux assigns right-sidebar digit shortcuts | ||
| /// from the visible tab order. The host constructs one resolver at its | ||
| /// composition root and passes it to the settings owner that needs it. A | ||
| /// resolver is a value, so previews and multiple hosts can use different | ||
| /// defaults in the same process without affecting one another. | ||
| public struct ShortcutDefaultResolver: Sendable { | ||
| /// The result of resolving one action's host default. | ||
| public enum Result: Sendable { | ||
| /// Use the package's built-in default. | ||
| case useBuiltIn | ||
| /// Use `stroke`; `nil` explicitly means the action is unbound. | ||
| case stroke(ShortcutStroke?) | ||
| } | ||
|
|
||
| /// A host callback that computes a default from current host state. | ||
| public typealias Provider = @Sendable (ShortcutAction) -> Result | ||
|
|
||
| private let provider: Provider | ||
|
|
||
| /// Creates a resolver backed by `provider`. | ||
| public init(provider: @escaping Provider) { | ||
| self.provider = provider | ||
| } | ||
|
|
||
| /// A resolver that always uses the package's built-in defaults. | ||
| public static let builtIn = Self(provider: { _ in .useBuiltIn }) | ||
|
|
||
| /// Resolves `action`, falling back to ``Result/useBuiltIn`` when the host | ||
| /// provider has no override. | ||
| func result(for action: ShortcutAction) -> Result { | ||
| provider(action) | ||
| } | ||
| } |
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Mark the new value-model struct
nonisolated.RightSidebarTabSettingsItemis a pure Sendable value struct with onlyString/Boolmembers. Mark itnonisolatedso it is not implicitly@MainActor-isolated.As per coding guidelines: "In Swift 6, mark Codable, Identifiable, Sendable, and pure value-model structs as
nonisolatedwhen they should not be implicitly@MainActor-isolated."♻️ Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents
Source: Coding guidelines