Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add is-fullscreen to list-windows json output #908

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 Sources/Common/cmdArgs/impl/ListWindowsCmdArgs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public extension ListWindowsCmdArgs {
? [
.interVar("window-id"), .interVar("right-padding"), .literal(" | "),
.interVar("app-name"), .interVar("right-padding"), .literal(" | "),
.interVar("window-is-fullscreen"), .interVar("right-padding"), .literal(" | "),
.interVar("window-title"),
]
: _format
Expand Down
Loading