Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960import ParcelCore
extension ParcelEngine { func takeMovementBatch() -> [Pending] { guard !isAutomaticTilingEnabled, let index = queue.firstIndex(where: \.isManualMovement) else { return takeRoomFeedbackBatch() } if index > 0 { let pending = Array(queue.prefix(index)) queue.removeFirst(index) return pending } if case .resolveRoom = queue[0].event { return takeRoomFeedbackBatch() } return [queue.removeFirst()] }
func manualWindows(for pending: [Pending], previous: State, next: State) -> Set<WindowID> { guard !isAutomaticTilingEnabled, pending.contains(where: \.isManualMovement) else { return [] } var windows = Set(next.frames.keys.filter { next.frames[$0] != previous.frames[$0] }) for item in pending { let event = item.event if item.isManualRuleReapplication, case .windowAppeared(let window, let key, _) = event { windows.insert(window.id) windows.formUnion(next.workspaces[key]?.visibleWindows ?? []) } let command: Command let key: WorkspaceKey? switch event { case .commandIssued(let value): command = value key = previous.activeWorkspace case .workspaceCommandIssued(let value, let workspace): command = value key = workspace case .commandForWindow(let window, let value, let workspace): command = value key = workspace ?? previous.workspace(containing: window) default: continue } switch command { case .retile, .resetSizes, .setLayout, .cycleLayout: guard let key else { continue } windows.formUnion(next.workspaces[key]?.visibleWindows ?? []) default: break } } return windows }}
extension Event { var isManualMovement: Bool { switch self { case .commandIssued, .workspaceCommandIssued, .commandForWindow, .gestureCommitted, .resolveRoom: true default: false } }}