Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354import Foundationpublic import ParcelConfigpublic import ParcelCore
public struct WindowActionHint: Equatable, Sendable { public let title: String public let message: String public let accessibilityMessage: String
public static func remainsCurrent(after: State, current: State, window: WindowID) -> Bool { guard let key = after.workspace(containing: window) else { return false } return current.focusedWindow == after.focusedWindow && current.frames == after.frames && current.activeSpaces == after.activeSpaces && current.workspaces[key] == after.workspaces[key] && current.modes(for: key) == after.modes(for: key) && current.undoHistory == after.undoHistory && current.windows[window]?.isFloating == after.windows[window]?.isFloating }
public static func make( request: HoverActionRequest, before: State, after: State, configuration: ParcelConfiguration ) -> Self? { guard after.workspace(containing: request.window) == request.workspace, after.isActive(request.workspace) else { return nil } let title: String let reverse: ConfigCommand switch request.action { case .toggleFocus: let wasFocused = before.modes(for: request.workspace).focusedWindow == request.window let focused = after.modes(for: request.workspace).focusedWindow == request.window guard wasFocused != focused else { return nil } title = UIStrings.text(focused ? "Focus" : "Exit Focus") reverse = .toggleFocus case .toggleFloat: guard let floating = after.windows[request.window]?.isFloating, floating != before.windows[request.window]?.isFloating else { return nil } title = UIStrings.text(floating ? "Float" : "Tile") reverse = .floatToggle case .makePrimary: guard before.frames != after.frames else { return nil } title = UIStrings.text("Primary") reverse = .undo case .alwaysFloat, .moveToDisplay: return nil } guard after.focusedWindow == request.window, let shortcut = configuration.keybindings[reverse] else { return Self(title: title, message: title, accessibilityMessage: title) } let format = UIStrings.text("%@ · %@ to put it back") return Self( title: title, message: String(format: format, title, shortcut.displayString), accessibilityMessage: String(format: format, title, shortcut.accessibilityLabel)) }}