Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283import Foundationpublic import ParcelAnimationpublic import ParcelConfigpublic import ParcelCore
public struct TourInstruction: Equatable, Sendable { public let title: String public let detail: String public let shortcut: String? public private(set) var shortcutAccessibilityLabel: String? public private(set) var detailAccessibilityLabel: String? public let ready: Bool
public init(tour: GuidedTour, state: State, configuration: ParcelConfiguration, active: Bool = true) { title = UIStrings.text(tour.step.titleKey) guard active else { detail = UIStrings.text("Turn on Accessibility access and resume tiling to try this step.") shortcut = nil ready = false return } if tour.progress.track == .keyboard { if let command = tour.command(state: state, configuration: configuration), let chord = configuration.keybindings[command] { detail = String( format: UIStrings.text( tour.step == .stack && command != .stack ? "First, try %@ to make room for a stack." : "Try %@. I'll wait right here."), command.settingsTitle) shortcut = chord.displayString shortcutAccessibilityLabel = chord.accessibilityLabel ready = true } else { detail = UIStrings.text( "Focus a tiled window with a neighbor. If this action isn't bound or there's no room, skip it for now." ) shortcut = nil ready = false } } else { shortcut = nil ready = configuration.mouse.enabled && state.visibleWindows.count > 1 guard configuration.mouse.enabled else { detail = UIStrings.text( "Mouse gestures are off. Choose the keyboard track, or turn them on in your config.") return } switch tour.step { case .focus: detail = UIStrings.text("Click another tiled window. That one's in charge now.") case .layout: detail = UIStrings.text("Pick a different layout from the Parcel menu.") case .swap: let format = UIStrings.text("Hold %@ and drag a window onto its neighbor to trade places.") detail = String(format: format, configuration.mouse.swapModifiers.displayString) detailAccessibilityLabel = String(format: format, configuration.mouse.swapModifiers.accessibilityLabel) case .stack: let format = UIStrings.text("Hold %@ and drag a window onto its neighbor to make a stack.") detail = String(format: format, configuration.mouse.stackModifiers.displayString) detailAccessibilityLabel = String(format: format, configuration.mouse.stackModifiers.accessibilityLabel) case .select: detail = UIStrings.text("Click a different chip in the gap to bring that window forward.") } } }
public static func celebrationMotion(configuration: MotionConfiguration, reduceMotion: Bool, step: TourStep) -> MotionBehavior { MotionPolicy(enabled: configuration.enabled, reduceMotion: reduceMotion).behavior(for: .overlay) }}
extension TourStep { var titleKey: String { switch self { case .focus: "Give a window your attention." case .layout: "Find a little rhythm." case .swap: "Try a new seat." case .stack: "Keep a few things together." case .select: "Bring one to the front." } }}