Something went wrong. Try again.
An auto tiler for macOS
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263import Foundationimport ParcelPlatform
public enum SpaceNotice { public static func message(for error: any Error) -> String { guard let failure = error as? SpaceCommandError else { return text("The Space command could not finish:") + " " + String(describing: error) } switch failure { case .shortcutDisabled(let action), .shortcutUnbound(let action): let name: String switch action { case .desktop(let number): name = String(format: text("Switch to Desktop %lld"), Int64(number)) case .moveLeft: name = text("Move left a space") case .moveRight: name = text("Move right a space") } return String( format: text( "Turn on “%@” and assign a shortcut in System Settings → Keyboard → Keyboard Shortcuts → Mission Control." ), name) case .busy: return text("Another Space command is still finishing. Try again in a moment.") case .pointerBusy: return text("Release the mouse or trackpad button before changing Spaces.") case .inputBusy: return text("Release modifier keys and pause typing before changing Spaces.") case .displayUnavailable: return text("Native Spaces are unavailable for the active display.") case .desktopUnavailable(let number): return String( format: text("Desktop %lld is not available on this display. Choose an existing desktop from 1 to 16."), Int64(number)) case .noAdjacentSpace: return text("There is no Space in that direction on this display.") case .noPreviousSpace: return text("There is no previous desktop to return to on this display yet.") case .fullscreen: return text("Windows cannot be moved to or from a fullscreen Space. Leave fullscreen first.") case .stageManager: return text( "Turn off Stage Manager in System Settings → Desktop & Dock before moving a window between Spaces.") case .titleBarUnavailable: return text("This window does not expose a safe title bar to drag. Move it using Mission Control instead.") case .windowUnavailable: return text("Choose a visible, focused window on one desktop before moving it between Spaces.") case .dragNotVerified: return text("The title-bar drag did not pick up this window. No Space shortcut was sent.") case .switchNotVerified: return text("macOS did not confirm the Space switch. Check your Mission Control shortcuts and try again.") case .moveNotVerified: return text( "macOS did not confirm that the window moved. Check its desktop in Mission Control before trying again." ) case .returnNotVerified: return text("The window moved, but macOS did not confirm the return to your original desktop.") case .malformedSnapshot: return text("The window server returned invalid Spaces data. The command was stopped.") case .symbolUnavailable(let name): return text("Native Spaces need a window-server feature that is unavailable:") + " " + name case .cleanupFailed(let operation, let cleanup): return text("The Space command failed and its input cleanup could not be confirmed:") + " " + operation + "; " + cleanup } }
private static func text(_ key: String) -> String { Bundle.module.localizedString(forKey: key, value: nil, table: "Localizable") }}