diff --git a/Sources/AppBundle/command/query/DebugWindowsCommand.swift b/Sources/AppBundle/command/query/DebugWindowsCommand.swift index e193df33..72a4b7ea 100644 --- a/Sources/AppBundle/command/query/DebugWindowsCommand.swift +++ b/Sources/AppBundle/command/query/DebugWindowsCommand.swift @@ -80,7 +80,7 @@ func debugWindowsIfRecording(_ window: Window) { return } let app = window.app as! MacApp - let appId = app.id ?? "null-app-id" + let appId = app.id ?? "NULL-APP-BUNDLE-ID" let windowPrefix = appId + ".window.\(window.windowId)" var result: [String] = [] diff --git a/Sources/AppBundle/command/query/ListAppsCommand.swift b/Sources/AppBundle/command/query/ListAppsCommand.swift index 18ce02ac..f3001e6d 100644 --- a/Sources/AppBundle/command/query/ListAppsCommand.swift +++ b/Sources/AppBundle/command/query/ListAppsCommand.swift @@ -13,7 +13,7 @@ struct ListAppsCommand: Command { state.stdout += result .map { app in let pid = String(app.pid) - let appId = app.id ?? "NULL-APP-ID" + let appId = app.id ?? "NULL-APP-BUNDLE-ID" let name = app.name ?? "NULL-NAME" return [pid, appId, name] } diff --git a/Sources/AppBundle/command/query/ListWindowsCommand.swift b/Sources/AppBundle/command/query/ListWindowsCommand.swift index 9be81caf..6f5d9d72 100644 --- a/Sources/AppBundle/command/query/ListWindowsCommand.swift +++ b/Sources/AppBundle/command/query/ListWindowsCommand.swift @@ -93,7 +93,7 @@ private extension String { case "window-title": .success(window.title) case "app-name": .success(window.app.name ?? "NULL-APP-NAME") case "app-pid": .success(window.app.pid.description) - case "app-id": .success(window.app.id ?? "NULL-APP-ID") + case "app-bundle-id": .success(window.app.id ?? "NULL-APP-BUNDLE-ID") case "workspace": .success(window.workspace?.name ?? "NULL-WOKRSPACE") case "monitor-id": .success(window.nodeMonitor?.monitorId?.description ?? "NULL-MONITOR-ID") case "monitor-name": .success(window.nodeMonitor?.name ?? "NULL-MONITOR-NAME") diff --git a/Sources/Common/cmdArgs/query/ListWindowsCmdArgs.swift b/Sources/Common/cmdArgs/query/ListWindowsCmdArgs.swift index c56d5f24..4aeb5cc1 100644 --- a/Sources/Common/cmdArgs/query/ListWindowsCmdArgs.swift +++ b/Sources/Common/cmdArgs/query/ListWindowsCmdArgs.swift @@ -11,19 +11,19 @@ public struct ListWindowsCmdArgs: RawCmdArgs, CmdArgs, Equatable { help: """ USAGE: list-windows [-h|--help] (--workspace \(_workspaces)|--monitor \(_monitors)) [--monitor \(_monitors)] [--workspace \(_workspaces)] - [--pid ] [--app-id ] [--format ] + [--pid ] [--app-bundle-id ] [--format ] OR: list-windows [-h|--help] --all [--format ] OR: list-windows [-h|--help] --focused [--format ] OPTIONS: - -h, --help Print help - --all Alias for "--monitor all" - --focused Print the focused window - --workspace \(_workspaces) Filter results to only print windows that belong to specified workspaces - --monitor \(_monitors) Filter results to only print the windows that are attached to specified monitors - --pid Filter results to only print windows that belong to the Application with specified - --app-id Filter results to only print windows that belong to the Application with specified Bundle ID - --format Specify output format + -h, --help Print help + --all Alias for "--monitor all" + --focused Print the focused window + --workspace \(_workspaces) Filter results to only print windows that belong to specified workspaces + --monitor \(_monitors) Filter results to only print the windows that are attached to specified monitors + --pid Filter results to only print windows that belong to the Application with specified + --app-bundle-id Filter results to only print windows that belong to the Application with specified Bundle ID + --format Specify output format """, options: [ "--focused": trueBoolFlag(\.focused), @@ -32,7 +32,7 @@ public struct ListWindowsCmdArgs: RawCmdArgs, CmdArgs, Equatable { "--monitor": ArgParser(\.monitors, parseMonitorIds), "--workspace": ArgParser(\.workspaces, parseWorkspaces), "--pid": singleValueOption(\.pidFilter, "", Int32.init), - "--app-id": singleValueOption(\.appIdFilter, "", { $0 }), + "--app-bundle-id": singleValueOption(\.appIdFilter, "", { $0 }), "--format": ArgParser(\.format, parseFormat), ], arguments: [] @@ -53,7 +53,8 @@ public struct ListWindowsCmdArgs: RawCmdArgs, CmdArgs, Equatable { } public func parseRawListWindowsCmdArgs(_ args: [String]) -> ParsedCmd { - parseRawCmdArgs(ListWindowsCmdArgs(rawArgs: .init(args)), args) + let args = args.map { $0 == "--app-id" ? "--app-bundle-id" : $0 } // Compatibility + return parseRawCmdArgs(ListWindowsCmdArgs(rawArgs: .init(args)), args) .flatMap { raw in var conflicting: OrderedSet = [] if (raw.all) { conflicting.insert("--all", at: 0) } diff --git a/args-grammar.conf b/args-grammar.conf index 59732c4e..f68bdd83 100644 --- a/args-grammar.conf +++ b/args-grammar.conf @@ -93,12 +93,12 @@ aerospace ; ::= --workspace ... | --monitor ... | --pid - | --app-id + | --app-bundle-id | ; ::= --format ; ::= {{{ true }}}; ::= visible | focused | ; - ::= {{{ true }}}; # todo + ::= {{{ true }}}; # todo ::= {{{ true }}}; # todo ::= all | mouse | focused; # todo diff --git a/docs/aerospace-list-windows.adoc b/docs/aerospace-list-windows.adoc index 42c4a29d..7884dba4 100644 --- a/docs/aerospace-list-windows.adoc +++ b/docs/aerospace-list-windows.adoc @@ -10,7 +10,7 @@ include::util/man-attributes.adoc[] // tag::synopsis[] aerospace list-windows [-h|--help] (--workspace ...|--monitor ...) [--monitor ...] [--workspace ...] - [--pid ] [--app-id ] [--format ] + [--pid ] [--app-bundle-id ] [--format ] aerospace list-windows [-h|--help] --all [--format ] aerospace list-windows [-h|--help] --focused [--format ] @@ -45,7 +45,10 @@ Possible values: + include::util/monitor-option.adoc[] --pid :: Filter results to only print windows that belong to the Application with specified `` ---app-id :: Filter results to only print windows that belong to the Application with specified https://developer.apple.com/documentation/appstoreconnectapi/bundle_ids[Bundle ID] +--app-bundle-id :: +Filter results to only print windows that belong to the Application with specified https://developer.apple.com/documentation/appstoreconnectapi/bundle_ids[Bundle ID] ++ +Deprecated (but still supported) flag name: `--app-id` --format :: Specify output format. See "Output Format" section for more details @@ -63,7 +66,7 @@ The following variables can be used inside ``: %{window-title}:: String. Window title %{app-name}:: String. Application name %{app-pid}:: Number. https://en.wikipedia.org/wiki/Process_identifier[UNIX process identifier] -%{app-id}:: String. Application unique identifier. https://developer.apple.com/documentation/appstoreconnectapi/bundle_ids[Bundle ID] +%{app-bundle-id}:: String. Application unique identifier. https://developer.apple.com/documentation/appstoreconnectapi/bundle_ids[Bundle ID] %{workspace}:: String. Name of the belonging workspace %{monitor-id}:: Number. Sequential number of the belonging monitor %{monitor-name}:: String. Name of the belonging monitor