Repository navigation
Add beta Workspace Tasks #6708
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
Closed
Closed
Add beta Workspace Tasks #6708
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
cd308d0
Add beta workspace tasks
azooz2003-bit 6b9515a
Fix workspace task socket routing
azooz2003-bit 2282e78
Gate existing workspace task views
azooz2003-bit 4216645
Bound workspace task mutations
azooz2003-bit 7ea152c
Restore mobile set-font path
azooz2003-bit ebbf4d0
Satisfy workspace tasks policy checks
azooz2003-bit 5b006c5
Fix workspace task review findings
azooz2003-bit 257ebfc
Localize mobile set font socket errors
azooz2003-bit f611e06
Reject stale workspace task pane targets
azooz2003-bit 6835fba
Resolve workspace task refs in CLI
azooz2003-bit 8ecf7c7
Fix workspace task transfer and mobile font scope parsing
azooz2003-bit a4ffb70
Preserve mobile live font streams across reconnects
azooz2003-bit 4e02502
Decode mobile font events at consumer
azooz2003-bit 17bce20
Merge remote-tracking branch 'origin/main' into task-workspace-tasks
azooz2003-bit b82d5cf
Address workspace tasks review feedback
azooz2003-bit 3a77384
Extract workspace tasks CLI handlers
azooz2003-bit e4484e9
Localize workspace tasks CLI strings
azooz2003-bit 1f2309f
Refresh Swift length budget for workspace tasks
azooz2003-bit ce6ba40
Restore mobile font event decode API
azooz2003-bit 6c301eb
Focus target workspace for task surface open
azooz2003-bit 9e9ca04
Focus task surface from sidebar popover
azooz2003-bit 9f22f4e
Tighten workspace task open and index handling
azooz2003-bit dee193f
Iterate workspace tasks UX
azooz2003-bit 3f7ce3e
Restyle workspace tasks UI
azooz2003-bit 34934fe
Show workspace task status in sidebar rows
azooz2003-bit 157570f
Merge origin/main into task-workspace-tasks
azooz2003-bit 4aeb39a
Normalize project file after merge
azooz2003-bit 1d95d9a
Merge remote-tracking branch 'origin/main' into task-workspace-tasks
azooz2003-bit f235782
Merge remote-tracking branch 'origin/main' into task-workspace-tasks
azooz2003-bit 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
51 changes: 51 additions & 0 deletions
51
Packages/macOS/CmuxSettings/Sources/CmuxSettings/Values/WorkspaceRowControlOption.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,51 @@ | ||
| import Foundation | ||
|
|
||
| /// Built-in hover controls that cmux can show on a sidebar workspace row. | ||
| /// | ||
| /// Stored under ``SidebarCatalogSection/workspaceControls`` as raw strings in | ||
| /// `sidebar.workspaceControls`. The close control is always included so users | ||
| /// cannot strand themselves without the existing hover close affordance. | ||
| public enum WorkspaceRowControlOption: String, CaseIterable, Sendable, SettingCodable { | ||
| /// Close the workspace. | ||
| case close | ||
| /// Open the workspace-scoped task list. | ||
| case tasks | ||
|
|
||
| /// Maximum number of built-in controls a workspace row may expose. | ||
| public static let maximumVisibleControls = 3 | ||
|
|
||
| /// Controls shown when no preference is stored. | ||
| public static let defaultControls: [WorkspaceRowControlOption] = [.close] | ||
|
|
||
| /// Returns a duplicate-free, capped list that always includes ``close``. | ||
| /// | ||
| /// Unknown raw values are dropped by callers before reaching this method. | ||
| /// The user's order is otherwise preserved, with ``close`` inserted first | ||
| /// only when it was absent. | ||
| public static func sanitized(_ controls: [WorkspaceRowControlOption]) -> [WorkspaceRowControlOption] { | ||
| var output: [WorkspaceRowControlOption] = [] | ||
| var seen = Set<WorkspaceRowControlOption>() | ||
|
|
||
| func append(_ option: WorkspaceRowControlOption) { | ||
| guard output.count < maximumVisibleControls, seen.insert(option).inserted else { return } | ||
| output.append(option) | ||
| } | ||
|
|
||
| if !controls.contains(.close) { | ||
| append(.close) | ||
| } | ||
| for option in controls { | ||
| append(option) | ||
| } | ||
| if output.isEmpty { | ||
| return defaultControls | ||
| } | ||
| return output | ||
| } | ||
|
|
||
| /// Decodes a raw string array from `cmux.json` / `UserDefaults`, dropping | ||
| /// unknown entries before applying the close-control invariant and cap. | ||
| public static func sanitizedRawValues(_ rawValues: [String]) -> [WorkspaceRowControlOption] { | ||
| sanitized(rawValues.compactMap { WorkspaceRowControlOption(rawValue: $0) }) | ||
| } | ||
| } |
40 changes: 40 additions & 0 deletions
40
Packages/macOS/CmuxSettings/Tests/CmuxSettingsTests/WorkspaceRowControlOptionTests.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,40 @@ | ||
| import Foundation | ||
| import Testing | ||
| @testable import CmuxSettings | ||
|
|
||
| @Suite("sidebar.workspaceControls") | ||
| struct WorkspaceRowControlOptionTests { | ||
| private func makeStore() -> (UserDefaultsSettingsStore, String, SettingCatalog) { | ||
| let suiteName = "cmux.workspaceControls.tests.\(UUID().uuidString)" | ||
| let store = UserDefaultsSettingsStore(defaults: UserDefaults(suiteName: suiteName)!) | ||
| return (store, suiteName, SettingCatalog()) | ||
| } | ||
|
|
||
| @Test func sanitizedAlwaysIncludesCloseAndCapsControls() { | ||
| let controls = WorkspaceRowControlOption.sanitized([.tasks, .tasks, .close]) | ||
| #expect(controls == [.tasks, .close]) | ||
|
|
||
| let missingClose = WorkspaceRowControlOption.sanitized([.tasks]) | ||
| #expect(missingClose == [.close, .tasks]) | ||
| } | ||
|
|
||
| @Test func sanitizedRawValuesDropsUnknownEntries() { | ||
| let controls = WorkspaceRowControlOption.sanitizedRawValues(["tasks", "unknown", "close", "tasks"]) | ||
| #expect(controls == [.tasks, .close]) | ||
| } | ||
|
|
||
| @Test func defaultsToCloseWhenUnset() async { | ||
| let (store, _, catalog) = makeStore() | ||
| let value = await store.value(for: catalog.sidebar.workspaceControls) | ||
| #expect(value == [.close]) | ||
| } | ||
|
|
||
| @Test func roundTripsThroughTheStore() async { | ||
| let (store, suiteName, catalog) = makeStore() | ||
| await store.set([.close, .tasks], for: catalog.sidebar.workspaceControls) | ||
| let value = await store.value(for: catalog.sidebar.workspaceControls) | ||
| #expect(value == [.close, .tasks]) | ||
| let defaults = UserDefaults(suiteName: suiteName)! | ||
| #expect(defaults.stringArray(forKey: catalog.sidebar.workspaceControls.userDefaultsKey) == ["close", "tasks"]) | ||
| } | ||
| } |
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.
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.