Skip to content

Commit 6e69925

Browse files
xiamaznikitabobko
authored andcommitted
Add more query data types
closes #1191 #846
1 parent 2acaa11 commit 6e69925

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

Sources/AppBundle/command/format.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ enum FormatVar: Equatable {
8282

8383
enum WorkspaceFormatVar: String, Equatable, CaseIterable {
8484
case workspaceName = "workspace"
85+
case workspaceFocused = "workspace-is-focused"
86+
case workspaceVisible = "workspace-is-visible"
8587
}
8688

8789
enum AppFormatVar: String, Equatable, CaseIterable {
@@ -184,6 +186,8 @@ extension String {
184186
case (.workspace(let w), .workspace(let f)):
185187
return switch f {
186188
case .workspaceName: .success(.string(w.name))
189+
case .workspaceVisible: .success(.bool(w.isVisible))
190+
case .workspaceFocused: .success(.bool(focus.workspace == w))
187191
}
188192
case (.monitor(let m), .monitor(let f)):
189193
return switch f {

docs/aerospace-list-windows.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ The following variables can be used inside `<output-format>`:
8787
%{app-bundle-path}:: String. Application bundle path
8888

8989
%{workspace}:: String. Name of the belonging workspace
90+
%{workspace-is-focused}:: Boolean. True if the workspace has focus
91+
%{workspace-is-visible}:: Boolean. True if the workspace is visible. A workspace can be visible but not focused in a multi-monitor setup
9092

9193
%{monitor-id}:: 1-based Number. Sequential number of the belonging monitor.
9294
%{monitor-appkit-nsscreen-screens-id}:: 1-based index of the belonging monitor in `NSScreen.screens` array. Useful for integration with other tools that might be using `NSScreen.screens` ordering (like sketchybar).

docs/aerospace-list-workspaces.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ If not specified, the default `<output-format>` is: +
6666
The following variables can be used inside `<output-format>`:
6767

6868
%{workspace}:: String. Name of the belonging workspace
69+
%{workspace-is-focused}:: Boolean. True if the workspace has focus
70+
%{workspace-is-visible}:: Boolean. True if the workspace is visible. A workspace can be visible but not focused in a multi-monitor setup
6971

7072
%{monitor-id}:: 1-based Number. Sequential number of the belonging monitor
7173
%{monitor-appkit-nsscreen-screens-id}:: 1-based Number. Sequential number of the belonging monitor in `NSScreen.screens`. Useful for integration with other tools that might be using `NSScreen.screens` ordering (like sketchybar).

0 commit comments

Comments
 (0)