From 930222a57e6b063464de3e18106de9f9b54738ce Mon Sep 17 00:00:00 2001 From: Jonathan Yu Date: Mon, 30 Dec 2024 13:40:04 -0600 Subject: [PATCH] feat: add is-fullscreen to list-windows json output https://github.com/nikitabobko/AeroSpace/issues/846 closes https://github.com/nikitabobko/AeroSpace/pull/908 --- Sources/AppBundle/command/format.swift | 5 +++++ docs/aerospace-list-windows.adoc | 1 + 2 files changed, 6 insertions(+) diff --git a/Sources/AppBundle/command/format.swift b/Sources/AppBundle/command/format.swift index 3191b0ff..2d573c93 100644 --- a/Sources/AppBundle/command/format.swift +++ b/Sources/AppBundle/command/format.swift @@ -75,6 +75,7 @@ enum FormatVar: Equatable { enum WindowFormatVar: String, Equatable, CaseIterable { case windowId = "window-id" + case windowIsFullscreen = "window-is-fullscreen" case windowTitle = "window-title" } @@ -98,6 +99,7 @@ enum FormatVar: Equatable { } enum Primitive: Encodable { + case bool(Bool) case int(Int) case int32(Int32) case uint32(UInt32) @@ -105,6 +107,7 @@ enum Primitive: Encodable { func toString() -> String { switch self { + case .bool(let x): x.description case .int(let x): x.description case .int32(let x): x.description case .uint32(let x): x.description @@ -114,6 +117,7 @@ enum Primitive: Encodable { func encode(to encoder: any Encoder) throws { let value: Encodable = switch self { + case .bool(let x): x case .int(let x): x case .int32(let x): x case .uint32(let x): x @@ -172,6 +176,7 @@ extension String { case (.window(let w), .window(let f)): return switch f { case .windowId: .success(.uint32(w.windowId)) + case .windowIsFullscreen: .success(.bool(w.isFullscreen)) case .windowTitle: .success(.string(w.title)) } case (.workspace(let w), .workspace(let f)): diff --git a/docs/aerospace-list-windows.adoc b/docs/aerospace-list-windows.adoc index 0504a15d..bff5758f 100644 --- a/docs/aerospace-list-windows.adoc +++ b/docs/aerospace-list-windows.adoc @@ -78,6 +78,7 @@ The following variables can be used inside ``: %{window-id}:: Number. Window unique ID %{window-title}:: String. Window title +%{window-is-fullscreen}:: Boolean. Is window in fullscreen by `aerospace fullscreen` command %{app-bundle-id}:: String. Application unique identifier. https://developer.apple.com/documentation/appstoreconnectapi/bundle_ids[Bundle ID] %{app-name}:: String. Application name