Skip to content

Commit

Permalink
feat: add is-fullscreen to list-windows json output
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathancyu authored and blueputty01 committed Jan 12, 2025
1 parent 5aeed77 commit f407d96
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sources/AppBundle/command/format.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand All @@ -98,13 +99,15 @@ enum FormatVar: Equatable {
}

enum Primitive: Encodable {
case bool(Bool)
case int(Int)
case int32(Int32)
case uint32(UInt32)
case string(String)

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
Expand All @@ -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
Expand Down Expand Up @@ -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)):
Expand Down
1 change: 1 addition & 0 deletions docs/aerospace-list-windows.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ The following variables can be used inside `<output-format>`:

%{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
Expand Down

0 comments on commit f407d96

Please sign in to comment.