aerospace fork
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738import AppKitimport Common
struct FullscreenCommand: Command { let args: FullscreenCmdArgs /*conforms*/ let shouldResetClosedWindowsCache = false
func run(_ env: CmdEnv, _ io: CmdIo) -> BinaryExitCode { guard let target = args.resolveTargetOrReportError(env, io) else { return .fail } guard let window = target.windowOrNil else { return .fail(io.err(noWindowIsFocused)) } let newState: Bool = switch args.toggle { case .on: true case .off: false case .toggle: !window.isFullscreen } if newState == window.isFullscreen { switch args.failIfNoop { case true: return .fail case false: let msg = newState ? "Already fullscreen. Tip: use --fail-if-noop to exit with non-zero code" : "Already not fullscreen. Tip: use --fail-if-noop to exit with non-zero code" return .succ(io.err(msg)) } } window.isFullscreen = newState window.noOuterGapsInFullscreen = args.noOuterGaps
// Focus on its own workspace window.markAsMostRecentChild() return .succ }}
let noWindowIsFocused = "No window is focused"