From 47209bdcef275d380e437ea14c7960f6b4f7b7f8 Mon Sep 17 00:00:00 2001 From: Nikita Bobko Date: Sun, 14 Jul 2024 16:00:01 +0200 Subject: [PATCH] Add --window-id and --workspace flags to all commands where it makes sense https://github.com/nikitabobko/AeroSpace/issues/186 --- .../Cli/subcommandDescriptionsGenerated.swift | 4 +- Sources/Common/cmdArgs/ArgParser.swift | 15 ++++++++ .../cmdArgs/impl/BalanceSizesCmdArgs.swift | 4 +- .../Common/cmdArgs/impl/CloseCmdArgs.swift | 1 + .../impl/FlattenWorkspaceTreeCmdArgs.swift | 4 +- .../cmdArgs/impl/FullscreenCmdArgs.swift | 1 + .../Common/cmdArgs/impl/LayoutCmdArgs.swift | 4 +- .../impl/MacosNativeFullscreenCmdArgs.swift | 1 + Sources/Common/cmdArgs/impl/MoveCmdArgs.swift | 4 +- .../impl/MoveNodeToMonitorCmdArgs.swift | 1 + .../impl/MoveNodeToWorkspaceCmdArgs.swift | 2 + .../impl/MoveWorkpsaceToMonitorCmdArgs.swift | 1 + .../Common/cmdArgs/impl/ResizeCmdArgs.swift | 4 +- .../Common/cmdArgs/impl/SplitCmdArgs.swift | 4 +- Sources/Common/cmdHelpGenerated.swift | 37 ++++++++++--------- docs/aerospace-balance-sizes.adoc | 11 ++++-- ...rospace-close-all-windows-but-current.adoc | 2 +- docs/aerospace-close.adoc | 9 +++-- docs/aerospace-flatten-workspace-tree.adoc | 10 +++-- docs/aerospace-focus-monitor.adoc | 4 +- docs/aerospace-fullscreen.adoc | 14 ++++--- docs/aerospace-layout.adoc | 8 +++- docs/aerospace-macos-native-fullscreen.adoc | 13 ++++--- docs/aerospace-macos-native-minimize.adoc | 6 +-- docs/aerospace-move-node-to-monitor.adoc | 11 ++++-- docs/aerospace-move-node-to-workspace.adoc | 7 +++- docs/aerospace-move-workspace-to-monitor.adoc | 8 +++- docs/aerospace-move.adoc | 19 ++++++---- docs/aerospace-resize.adoc | 12 ++++-- docs/aerospace-split.adoc | 8 +++- docs/util/window-id-flag-desc.adoc | 1 + docs/util/workspace-flag-desc.adoc | 1 + grammar/commands-bnf-grammar.txt | 25 ++++++------- 33 files changed, 166 insertions(+), 90 deletions(-) create mode 100644 docs/util/window-id-flag-desc.adoc create mode 100644 docs/util/workspace-flag-desc.adoc diff --git a/Sources/Cli/subcommandDescriptionsGenerated.swift b/Sources/Cli/subcommandDescriptionsGenerated.swift index 81153d4a..b39db402 100644 --- a/Sources/Cli/subcommandDescriptionsGenerated.swift +++ b/Sources/Cli/subcommandDescriptionsGenerated.swift @@ -25,9 +25,9 @@ let subcommandDescriptions = [ [" move-node-to-monitor", "Move window to monitor targeted by relative direction, by order, or by pattern"], [" move-node-to-workspace", "Move the focused window to the specified workspace"], [" move-workspace-to-monitor", "Move the focused workspace to the next or previous monitor"], - [" move", "Move the window in the given direction"], + [" move", "Move the focused window in the given direction"], [" reload-config", "Reload currently active config"], - [" resize", "Resize the currently focused window"], + [" resize", "Resize the focused window"], [" split", "Split focused window"], [" trigger-binding", "Trigger AeroSpace binding as if it was pressed by user"], [" workspace-back-and-forth", "Switch between the focused workspace and previously focused workspace back and forth"], diff --git a/Sources/Common/cmdArgs/ArgParser.swift b/Sources/Common/cmdArgs/ArgParser.swift index 14d30ff6..27c92f5b 100644 --- a/Sources/Common/cmdArgs/ArgParser.swift +++ b/Sources/Common/cmdArgs/ArgParser.swift @@ -25,6 +25,13 @@ public struct ArgParser: ArgParserProtocol { public func hash(into hasher: inout Hasher) { hasher.combine(keyPath) } } +public func optionalWindowIdFlag() -> ArgParser { + ArgParser(\T.windowId, upcastArgParserFun(parseArgWithUInt32)) +} +public func optionalWorkspaceFlag() -> ArgParser { + ArgParser(\T.workspaceName, upcastArgParserFun(parseArgWithWorkspaceName)) +} + func newArgParser( _ keyPath: WritableKeyPath>, _ parse: @escaping (String, inout [String]) -> Parsed, @@ -96,4 +103,12 @@ public func parseArgWithUInt32(arg: String, nextArgs: inout [String]) -> Parsed< } } +public func parseArgWithWorkspaceName(arg: String, nextArgs: inout [String]) -> Parsed { + if let arg = nextArgs.nextNonFlagOrNil() { + WorkspaceName.parse(arg) + } else { + .failure("'\(arg)' must be followed by mandatory workspace name") + } +} + func upcastArgParserFun(_ fun: @escaping ArgParserFun) -> ArgParserFun { { fun($0, &$1).map { $0 } } } diff --git a/Sources/Common/cmdArgs/impl/BalanceSizesCmdArgs.swift b/Sources/Common/cmdArgs/impl/BalanceSizesCmdArgs.swift index 2ce75e9f..9ffacd6a 100644 --- a/Sources/Common/cmdArgs/impl/BalanceSizesCmdArgs.swift +++ b/Sources/Common/cmdArgs/impl/BalanceSizesCmdArgs.swift @@ -5,7 +5,9 @@ public struct BalanceSizesCmdArgs: CmdArgs { kind: .balanceSizes, allowInConfig: true, help: balance_sizes_help_generated, - options: [:], + options: [ + "--workspace": optionalWorkspaceFlag(), + ], arguments: [] ) diff --git a/Sources/Common/cmdArgs/impl/CloseCmdArgs.swift b/Sources/Common/cmdArgs/impl/CloseCmdArgs.swift index 3107373b..3ad2fdff 100644 --- a/Sources/Common/cmdArgs/impl/CloseCmdArgs.swift +++ b/Sources/Common/cmdArgs/impl/CloseCmdArgs.swift @@ -7,6 +7,7 @@ public struct CloseCmdArgs: CmdArgs { help: close_help_generated, options: [ "--quit-if-last-window": trueBoolFlag(\.quitIfLastWindow), + "--window-id": optionalWindowIdFlag(), ], arguments: [] ) diff --git a/Sources/Common/cmdArgs/impl/FlattenWorkspaceTreeCmdArgs.swift b/Sources/Common/cmdArgs/impl/FlattenWorkspaceTreeCmdArgs.swift index 333adc5a..f3db14d3 100644 --- a/Sources/Common/cmdArgs/impl/FlattenWorkspaceTreeCmdArgs.swift +++ b/Sources/Common/cmdArgs/impl/FlattenWorkspaceTreeCmdArgs.swift @@ -5,7 +5,9 @@ public struct FlattenWorkspaceTreeCmdArgs: CmdArgs { kind: .flattenWorkspaceTree, allowInConfig: true, help: flatten_workspace_tree_help_generated, - options: [:], + options: [ + "--workspace": optionalWorkspaceFlag(), + ], arguments: [] ) diff --git a/Sources/Common/cmdArgs/impl/FullscreenCmdArgs.swift b/Sources/Common/cmdArgs/impl/FullscreenCmdArgs.swift index 7f643ef2..514c09f7 100644 --- a/Sources/Common/cmdArgs/impl/FullscreenCmdArgs.swift +++ b/Sources/Common/cmdArgs/impl/FullscreenCmdArgs.swift @@ -8,6 +8,7 @@ public struct FullscreenCmdArgs: CmdArgs { options: [ "--no-outer-gaps": trueBoolFlag(\.noOuterGaps), "--fail-if-noop": trueBoolFlag(\.failIfNoop), + "--window-id": optionalWindowIdFlag(), ], arguments: [ArgParser(\.toggle, parseToggleEnum)] ) diff --git a/Sources/Common/cmdArgs/impl/LayoutCmdArgs.swift b/Sources/Common/cmdArgs/impl/LayoutCmdArgs.swift index 99fd686f..505c78d0 100644 --- a/Sources/Common/cmdArgs/impl/LayoutCmdArgs.swift +++ b/Sources/Common/cmdArgs/impl/LayoutCmdArgs.swift @@ -5,7 +5,9 @@ public struct LayoutCmdArgs: CmdArgs { kind: .layout, allowInConfig: true, help: layout_help_generated, - options: [:], + options: [ + "--window-id": optionalWindowIdFlag(), + ], arguments: [newArgParser(\.toggleBetween, parseToggleBetween, mandatoryArgPlaceholder: LayoutDescription.unionLiteral)] ) diff --git a/Sources/Common/cmdArgs/impl/MacosNativeFullscreenCmdArgs.swift b/Sources/Common/cmdArgs/impl/MacosNativeFullscreenCmdArgs.swift index 6b86a287..63bc2865 100644 --- a/Sources/Common/cmdArgs/impl/MacosNativeFullscreenCmdArgs.swift +++ b/Sources/Common/cmdArgs/impl/MacosNativeFullscreenCmdArgs.swift @@ -7,6 +7,7 @@ public struct MacosNativeFullscreenCmdArgs: CmdArgs { help: macos_native_fullscreen_help_generated, options: [ "--fail-if-noop": trueBoolFlag(\.failIfNoop), + "--window-id": optionalWindowIdFlag(), ], arguments: [ArgParser(\.toggle, parseToggleEnum)] ) diff --git a/Sources/Common/cmdArgs/impl/MoveCmdArgs.swift b/Sources/Common/cmdArgs/impl/MoveCmdArgs.swift index b70fc672..4acd85fb 100644 --- a/Sources/Common/cmdArgs/impl/MoveCmdArgs.swift +++ b/Sources/Common/cmdArgs/impl/MoveCmdArgs.swift @@ -5,7 +5,9 @@ public struct MoveCmdArgs: CmdArgs { kind: .move, allowInConfig: true, help: move_help_generated, - options: [:], + options: [ + "--window-id": optionalWindowIdFlag(), + ], arguments: [newArgParser(\.direction, parseCardinalDirectionArg, mandatoryArgPlaceholder: CardinalDirection.unionLiteral)] ) diff --git a/Sources/Common/cmdArgs/impl/MoveNodeToMonitorCmdArgs.swift b/Sources/Common/cmdArgs/impl/MoveNodeToMonitorCmdArgs.swift index ae9d7f21..8663d94e 100644 --- a/Sources/Common/cmdArgs/impl/MoveNodeToMonitorCmdArgs.swift +++ b/Sources/Common/cmdArgs/impl/MoveNodeToMonitorCmdArgs.swift @@ -7,6 +7,7 @@ public struct MoveNodeToMonitorCmdArgs: CmdArgs { help: move_node_to_monitor_help_generated, options: [ "--wrap-around": trueBoolFlag(\.wrapAround), + "--window-id": optionalWindowIdFlag(), ], arguments: [newArgParser(\.target, parseTarget, mandatoryArgPlaceholder: "(left|down|up|right|next|prev|)")] ) diff --git a/Sources/Common/cmdArgs/impl/MoveNodeToWorkspaceCmdArgs.swift b/Sources/Common/cmdArgs/impl/MoveNodeToWorkspaceCmdArgs.swift index f724272c..3ae60265 100644 --- a/Sources/Common/cmdArgs/impl/MoveNodeToWorkspaceCmdArgs.swift +++ b/Sources/Common/cmdArgs/impl/MoveNodeToWorkspaceCmdArgs.swift @@ -8,6 +8,7 @@ public struct MoveNodeToWorkspaceCmdArgs: CmdArgs { options: [ "--wrap-around": optionalTrueBoolFlag(\._wrapAround), "--fail-if-noop": trueBoolFlag(\.failIfNoop), + "--window-id": optionalWindowIdFlag(), ], arguments: [newArgParser(\.target, parseWorkspaceTarget, mandatoryArgPlaceholder: workspaceTargetPlaceholder)] ) @@ -32,4 +33,5 @@ public func parseMoveNodeToWorkspaceCmdArgs(_ args: [String]) -> ParsedCmd"), diff --git a/Sources/Common/cmdArgs/impl/SplitCmdArgs.swift b/Sources/Common/cmdArgs/impl/SplitCmdArgs.swift index 1fbe8348..754fd042 100644 --- a/Sources/Common/cmdArgs/impl/SplitCmdArgs.swift +++ b/Sources/Common/cmdArgs/impl/SplitCmdArgs.swift @@ -5,7 +5,9 @@ public struct SplitCmdArgs: CmdArgs { kind: .split, allowInConfig: true, help: split_help_generated, - options: [:], + options: [ + "--window-id": optionalWindowIdFlag(), + ], arguments: [newArgParser(\.arg, parseSplitArg, mandatoryArgPlaceholder: SplitArg.unionLiteral)] ) diff --git a/Sources/Common/cmdHelpGenerated.swift b/Sources/Common/cmdHelpGenerated.swift index bbeb3567..5f9a6f30 100644 --- a/Sources/Common/cmdHelpGenerated.swift +++ b/Sources/Common/cmdHelpGenerated.swift @@ -1,13 +1,13 @@ // FILE IS GENERATED BY generate.sh --all let balance_sizes_help_generated = """ - USAGE: balance-sizes [-h|--help] + USAGE: balance-sizes [-h|--help] [--workspace ] """ let close_all_windows_but_current_help_generated = """ USAGE: close-all-windows-but-current [-h|--help] [--quit-if-last-window] """ let close_help_generated = """ - USAGE: close [-h|--help] [--quit-if-last-window] + USAGE: close [-h|--help] [--quit-if-last-window] [--window-id ] """ let config_help_generated = """ USAGE: config [-h|--help] --get [--json] [--keys] @@ -27,7 +27,7 @@ let exec_and_forget_help_generated = """ USAGE: exec-and-forget """ let flatten_workspace_tree_help_generated = """ - USAGE: flatten-workspace-tree [-h|--help] + USAGE: flatten-workspace-tree [-h|--help] [--workspace ] """ let focus_back_and_forth_help_generated = """ USAGE: focus-back-and-forth [-h|--help] @@ -45,15 +45,16 @@ let focus_help_generated = """ OR: focus [-h|--help] --dfs-index """ let fullscreen_help_generated = """ - USAGE: fullscreen [-h|--help] [--no-outer-gaps] - OR: fullscreen [-h|--help] on [--no-outer-gaps] [--fail-if-noop] - OR: fullscreen [-h|--help] off [--fail-if-noop] + USAGE: fullscreen [-h|--help] [--window-id ] [--no-outer-gaps] + OR: fullscreen [-h|--help] on [--window-id ] [--no-outer-gaps] [--fail-if-noop] + OR: fullscreen [-h|--help] off [--window-id ] [--fail-if-noop] """ let join_with_help_generated = """ USAGE: join-with [-h|--help] (left|down|up|right) """ let layout_help_generated = """ - USAGE: layout [-h|--help] (h_tiles|v_tiles|h_accordion|v_accordion|tiles|accordion|horizontal|vertical|tiling|floating)... + USAGE: layout [-h|--help] [--window-id ] + (h_tiles|v_tiles|h_accordion|v_accordion|tiles|accordion|horizontal|vertical|tiling|floating)... """ let list_apps_help_generated = """ USAGE: list-apps [-h|--help] [--macos-native-hidden [no]] [--format ] @@ -77,9 +78,9 @@ let list_workspaces_help_generated = """ OR: list-workspaces [-h|--help] --focused [--format ] """ let macos_native_fullscreen_help_generated = """ - USAGE: macos-native-fullscreen [-h|--help] - OR: macos-native-fullscreen [-h|--help] [--fail-if-noop] on - OR: macos-native-fullscreen [-h|--help] [--fail-if-noop] off + USAGE: macos-native-fullscreen [-h|--help] [--window-id ] + OR: macos-native-fullscreen [-h|--help] [--window-id ] [--fail-if-noop] on + OR: macos-native-fullscreen [-h|--help] [--window-id ] [--fail-if-noop] off """ let macos_native_minimize_help_generated = """ USAGE: macos-native-minimize [-h|--help] @@ -91,28 +92,28 @@ let move_mouse_help_generated = """ USAGE: move-mouse [-h|--help] [--fail-if-noop] """ let move_node_to_monitor_help_generated = """ - USAGE: move-node-to-monitor [-h|--help] [--wrap-around] (left|down|up|right) - OR: move-node-to-monitor [-h|--help] [--wrap-around] (next|prev) - OR: move-node-to-monitor [-h|--help] ... + USAGE: move-node-to-monitor [-h|--help] [--window-id ] [--wrap-around] (left|down|up|right) + OR: move-node-to-monitor [-h|--help] [--window-id ] [--wrap-around] (next|prev) + OR: move-node-to-monitor [-h|--help] [--window-id ] ... """ let move_node_to_workspace_help_generated = """ USAGE: move-node-to-workspace [-h|--help] [--wrap-around] (next|prev) - OR: move-node-to-workspace [-h|--help] [--fail-if-noop] + OR: move-node-to-workspace [-h|--help] [--fail-if-noop] [--window-id ] """ let move_workspace_to_monitor_help_generated = """ - USAGE: move-workspace-to-monitor [-h|--help] [--wrap-around] (next|prev) + USAGE: move-workspace-to-monitor [-h|--help] [--workspace ] [--wrap-around] (next|prev) """ let move_help_generated = """ - USAGE: move [-h|--help] (left|down|up|right) + USAGE: move [-h|--help] [--window-id ] (left|down|up|right) """ let reload_config_help_generated = """ USAGE: reload-config [-h|--help] [--no-gui] [--dry-run] """ let resize_help_generated = """ - USAGE: resize [-h|--help] (smart|width|height) [+|-] + USAGE: resize [-h|--help] [--window-id ] (smart|width|height) [+|-] """ let split_help_generated = """ - USAGE: split [-h|--help] (horizontal|vertical|opposite) + USAGE: split [-h|--help] [--window-id ] (horizontal|vertical|opposite) """ let trigger_binding_help_generated = """ USAGE: trigger-binding [-h|--help] --mode diff --git a/docs/aerospace-balance-sizes.adoc b/docs/aerospace-balance-sizes.adoc index c2540e0c..b359c19e 100644 --- a/docs/aerospace-balance-sizes.adoc +++ b/docs/aerospace-balance-sizes.adoc @@ -9,7 +9,7 @@ include::util/man-attributes.adoc[] == Synopsis [verse] // tag::synopsis[] -aerospace balance-sizes [-h|--help] +aerospace balance-sizes [-h|--help] [--workspace ] // end::synopsis[] @@ -19,12 +19,15 @@ aerospace balance-sizes [-h|--help] // tag::body[] {manpurpose} -// end::body[] - // =========================================================== Options -include::util/conditional-options-header.adoc[] +include::./util/conditional-options-header.adoc[] -h, --help:: Print help +--workspace :: +include::./util/workspace-flag-desc.adoc[] + +// end::body[] + // =========================================================== Footer include::util/man-footer.adoc[] diff --git a/docs/aerospace-close-all-windows-but-current.adoc b/docs/aerospace-close-all-windows-but-current.adoc index 005a20da..92684f9d 100644 --- a/docs/aerospace-close-all-windows-but-current.adoc +++ b/docs/aerospace-close-all-windows-but-current.adoc @@ -23,8 +23,8 @@ aerospace close-all-windows-but-current [-h|--help] [--quit-if-last-window] include::util/conditional-options-header.adoc[] -h, --help:: Print help - --quit-if-last-window:: Quit the apps instead of closing them if it's their last window + // end::body[] // =========================================================== Footer diff --git a/docs/aerospace-close.adoc b/docs/aerospace-close.adoc index 8bdfa286..9c9836d9 100644 --- a/docs/aerospace-close.adoc +++ b/docs/aerospace-close.adoc @@ -9,7 +9,7 @@ include::util/man-attributes.adoc[] == Synopsis [verse] // tag::synopsis[] -aerospace close [-h|--help] [--quit-if-last-window] +aerospace close [-h|--help] [--quit-if-last-window] [--window-id ] // end::synopsis[] @@ -23,11 +23,14 @@ Normally, you don’t need to use this command, because macOS offers its own `cm You might want to use the command from CLI for scripting purposes // =========================================================== Options -include::util/conditional-options-header.adoc[] +include::./util/conditional-options-header.adoc[] -h, --help:: Print help - --quit-if-last-window:: Quit the app instead of closing if it's the last window of the app + +--window-id :: +include::./util/window-id-flag-desc.adoc[] + // end::body[] // =========================================================== Footer diff --git a/docs/aerospace-flatten-workspace-tree.adoc b/docs/aerospace-flatten-workspace-tree.adoc index ddc8878f..d6b76c57 100644 --- a/docs/aerospace-flatten-workspace-tree.adoc +++ b/docs/aerospace-flatten-workspace-tree.adoc @@ -9,7 +9,7 @@ include::util/man-attributes.adoc[] == Synopsis [verse] // tag::synopsis[] -aerospace flatten-workspace-tree [-h|--help] +aerospace flatten-workspace-tree [-h|--help] [--workspace ] // end::synopsis[] @@ -20,12 +20,16 @@ aerospace flatten-workspace-tree [-h|--help] {manpurpose} The command is useful when you messed up with your layout, and it's easier to "reset" it and start again. -// end::body[] // =========================================================== Options -include::util/conditional-options-header.adoc[] +include::./util/conditional-options-header.adoc[] -h, --help:: Print help +--workspace :: +include::./util/workspace-flag-desc.adoc[] + +// end::body[] + // =========================================================== Footer include::util/man-footer.adoc[] diff --git a/docs/aerospace-focus-monitor.adoc b/docs/aerospace-focus-monitor.adoc index 77454480..5c2969de 100644 --- a/docs/aerospace-focus-monitor.adoc +++ b/docs/aerospace-focus-monitor.adoc @@ -22,13 +22,13 @@ aerospace focus-monitor [-h|--help] ... {manpurpose} // =========================================================== Options -include::util/conditional-options-header.adoc[] +include::./util/conditional-options-header.adoc[] -h, --help:: Print help --wrap-around:: Make it possible to wrap around focus // =========================================================== Arguments -include::util/conditional-arguments-header.adoc[] +include::./util/conditional-arguments-header.adoc[] (left|down|up|right):: Focus monitor in direction relative to the focused monitor diff --git a/docs/aerospace-fullscreen.adoc b/docs/aerospace-fullscreen.adoc index 8961ccef..f61c801b 100644 --- a/docs/aerospace-fullscreen.adoc +++ b/docs/aerospace-fullscreen.adoc @@ -9,9 +9,9 @@ include::util/man-attributes.adoc[] == Synopsis [verse] // tag::synopsis[] -aerospace fullscreen [-h|--help] [--no-outer-gaps] -aerospace fullscreen [-h|--help] on [--no-outer-gaps] [--fail-if-noop] -aerospace fullscreen [-h|--help] off [--fail-if-noop] +aerospace fullscreen [-h|--help] [--window-id ] [--no-outer-gaps] +aerospace fullscreen [-h|--help] on [--window-id ] [--no-outer-gaps] [--fail-if-noop] +aerospace fullscreen [-h|--help] off [--window-id ] [--fail-if-noop] // end::synopsis[] @@ -24,15 +24,17 @@ aerospace fullscreen [-h|--help] off [--fail-if-noop] Switching to a different tiling window within the same workspace while the current focused window is in fullscreen mode results in the fullscreen window exiting fullscreen mode. // =========================================================== Options -include::util/conditional-options-header.adoc[] +include::./util/conditional-options-header.adoc[] -h, --help:: Print help - --no-outer-gaps:: Remove the outer gaps when in fullscreen mode --fail-if-noop:: Exit with non-zero exit code if already fullscreen or already not fullscreen +--window-id :: +include::./util/window-id-flag-desc.adoc[] + // =========================================================== Arguments -include::util/conditional-arguments-header.adoc[] +include::./util/conditional-arguments-header.adoc[] on, off:: `on` means enter fullscreen mode. `off` means exit fullscreen mode. diff --git a/docs/aerospace-layout.adoc b/docs/aerospace-layout.adoc index 1fa3b6ff..83aeece1 100644 --- a/docs/aerospace-layout.adoc +++ b/docs/aerospace-layout.adoc @@ -9,7 +9,8 @@ include::util/man-attributes.adoc[] == Synopsis [verse] // tag::synopsis[] -aerospace layout [-h|--help] (h_tiles|v_tiles|h_accordion|v_accordion|tiles|accordion|horizontal|vertical|tiling|floating)... +aerospace layout [-h|--help] [--window-id ] + (h_tiles|v_tiles|h_accordion|v_accordion|tiles|accordion|horizontal|vertical|tiling|floating)... // end::synopsis[] @@ -27,10 +28,13 @@ If several arguments are supplied then finds the first argument that doesn't des * Toggle floating/tiling mode: `tiling|floating` // =========================================================== Options -include::util/conditional-options-header.adoc[] +include::./util/conditional-options-header.adoc[] -h, --help:: Print help +--window-id :: +include::./util/window-id-flag-desc.adoc[] + // =========================================================== Examples include::util/conditional-examples-header.adoc[] diff --git a/docs/aerospace-macos-native-fullscreen.adoc b/docs/aerospace-macos-native-fullscreen.adoc index b742249c..8c6fade1 100644 --- a/docs/aerospace-macos-native-fullscreen.adoc +++ b/docs/aerospace-macos-native-fullscreen.adoc @@ -9,9 +9,9 @@ include::util/man-attributes.adoc[] == Synopsis [verse] // tag::synopsis[] -aerospace macos-native-fullscreen [-h|--help] -aerospace macos-native-fullscreen [-h|--help] [--fail-if-noop] on -aerospace macos-native-fullscreen [-h|--help] [--fail-if-noop] off +aerospace macos-native-fullscreen [-h|--help] [--window-id ] +aerospace macos-native-fullscreen [-h|--help] [--window-id ] [--fail-if-noop] on +aerospace macos-native-fullscreen [-h|--help] [--window-id ] [--fail-if-noop] off // end::synopsis[] @@ -22,13 +22,16 @@ aerospace macos-native-fullscreen [-h|--help] [--fail-if-noop] off {manpurpose} // =========================================================== Options -include::util/conditional-options-header.adoc[] +include::./util/conditional-options-header.adoc[] -h, --help:: Print help --fail-if-noop:: Exit with non-zero exit code if already fullscreen or already not fullscreen +--window-id :: +include::./util/window-id-flag-desc.adoc[] + // =========================================================== Arguments -include::util/conditional-arguments-header.adoc[] +include::./util/conditional-arguments-header.adoc[] on, off:: `on` means enter fullscreen mode. diff --git a/docs/aerospace-macos-native-minimize.adoc b/docs/aerospace-macos-native-minimize.adoc index bafa74d6..28170321 100644 --- a/docs/aerospace-macos-native-minimize.adoc +++ b/docs/aerospace-macos-native-minimize.adoc @@ -19,12 +19,12 @@ aerospace macos-native-minimize [-h|--help] // tag::body[] {manpurpose} -// end::body[] - // =========================================================== Options -include::util/conditional-options-header.adoc[] +include::./util/conditional-options-header.adoc[] -h, --help:: Print help +// end::body[] + // =========================================================== Footer include::util/man-footer.adoc[] diff --git a/docs/aerospace-move-node-to-monitor.adoc b/docs/aerospace-move-node-to-monitor.adoc index 088aed7b..ebc881c3 100644 --- a/docs/aerospace-move-node-to-monitor.adoc +++ b/docs/aerospace-move-node-to-monitor.adoc @@ -9,9 +9,9 @@ include::util/man-attributes.adoc[] == Synopsis [verse] // tag::synopsis[] -aerospace move-node-to-monitor [-h|--help] [--wrap-around] (left|down|up|right) -aerospace move-node-to-monitor [-h|--help] [--wrap-around] (next|prev) -aerospace move-node-to-monitor [-h|--help] ... +aerospace move-node-to-monitor [-h|--help] [--window-id ] [--wrap-around] (left|down|up|right) +aerospace move-node-to-monitor [-h|--help] [--window-id ] [--wrap-around] (next|prev) +aerospace move-node-to-monitor [-h|--help] [--window-id ] ... // end::synopsis[] @@ -22,11 +22,14 @@ aerospace move-node-to-monitor [-h|--help] ... {manpurpose} // =========================================================== Options -include::util/conditional-options-header.adoc[] +include::./util/conditional-options-header.adoc[] -h, --help:: Print help --wrap-around:: Make it possible to wrap around the movement +--window-id :: +include::./util/window-id-flag-desc.adoc[] + // =========================================================== Arguments include::util/conditional-arguments-header.adoc[] diff --git a/docs/aerospace-move-node-to-workspace.adoc b/docs/aerospace-move-node-to-workspace.adoc index 53b159ee..df0d66fc 100644 --- a/docs/aerospace-move-node-to-workspace.adoc +++ b/docs/aerospace-move-node-to-workspace.adoc @@ -10,7 +10,7 @@ include::util/man-attributes.adoc[] [verse] // tag::synopsis[] aerospace move-node-to-workspace [-h|--help] [--wrap-around] (next|prev) -aerospace move-node-to-workspace [-h|--help] [--fail-if-noop] +aerospace move-node-to-workspace [-h|--help] [--fail-if-noop] [--window-id ] // end::synopsis[] @@ -23,12 +23,15 @@ aerospace move-node-to-workspace [-h|--help] [--fail-if-noop] `(next|prev)` is identical to `workspace (next|prev)` // =========================================================== Options -include::util/conditional-options-header.adoc[] +include::./util/conditional-options-header.adoc[] -h, --help:: Print help --wrap-around:: Make it possible to jump between first and last workspaces using (next|prev) --fail-if-noop:: Exit with non-zero code if move window to workspace it already belongs to +--window-id :: +include::./util/window-id-flag-desc.adoc[] + // end::body[] // =========================================================== Footer diff --git a/docs/aerospace-move-workspace-to-monitor.adoc b/docs/aerospace-move-workspace-to-monitor.adoc index 43a6730a..19b24820 100644 --- a/docs/aerospace-move-workspace-to-monitor.adoc +++ b/docs/aerospace-move-workspace-to-monitor.adoc @@ -9,7 +9,7 @@ include::util/man-attributes.adoc[] == Synopsis [verse] // tag::synopsis[] -aerospace move-workspace-to-monitor [-h|--help] [--wrap-around] (next|prev) +aerospace move-workspace-to-monitor [-h|--help] [--workspace ] [--wrap-around] (next|prev) // end::synopsis[] @@ -22,10 +22,14 @@ aerospace move-workspace-to-monitor [-h|--help] [--wrap-around] (next|prev) The command doesn't have effect on workspaces xref:guide.adoc#assign-workspaces-to-monitors[that have monitor assignment] // =========================================================== Options -include::util/conditional-options-header.adoc[] +include::./util/conditional-options-header.adoc[] -h, --help:: Print help --wrap-around:: Allows to move workspace between first and last monitors + +--workspace :: +include::./util/workspace-flag-desc.adoc[] + // end::body[] // =========================================================== Footer diff --git a/docs/aerospace-move.adoc b/docs/aerospace-move.adoc index 37e13d9f..e1613ebf 100644 --- a/docs/aerospace-move.adoc +++ b/docs/aerospace-move.adoc @@ -1,7 +1,7 @@ = aerospace-move(1) include::util/man-attributes.adoc[] // tag::purpose[] -:manpurpose: Move the window in the given direction +:manpurpose: Move the focused window in the given direction // end::purpose[] :manname: aerospace-move @@ -9,7 +9,7 @@ include::util/man-attributes.adoc[] == Synopsis [verse] // tag::synopsis[] -aerospace move [-h|--help] (left|down|up|right) +aerospace move [-h|--help] [--window-id ] (left|down|up|right) // end::synopsis[] @@ -17,10 +17,18 @@ aerospace move [-h|--help] (left|down|up|right) == Description // tag::body[] -{manpurpose} +Move the focused window in the given direction. See the "Examples" section for more details. Deprecated name: `move-through` +// =========================================================== Options +include::./util/conditional-options-header.adoc[] + +-h, --help:: Print help + +--window-id :: +include::./util/window-id-flag-desc.adoc[] + // =========================================================== Examples include::util/conditional-examples-header.adoc[] @@ -110,10 +118,5 @@ v_tiles // end::body[] -// =========================================================== Options -include::util/conditional-options-header.adoc[] - --h, --help:: Print help - // =========================================================== Footer include::util/man-footer.adoc[] diff --git a/docs/aerospace-resize.adoc b/docs/aerospace-resize.adoc index 93001602..4de1a3d4 100644 --- a/docs/aerospace-resize.adoc +++ b/docs/aerospace-resize.adoc @@ -2,14 +2,14 @@ include::util/man-attributes.adoc[] :manname: aerospace-resize // tag::purpose[] -:manpurpose: Resize the currently focused window +:manpurpose: Resize the focused window // end::purpose[] // =========================================================== Synopsis == Synopsis [verse] // tag::synopsis[] -aerospace resize [-h|--help] (smart|width|height) [+|-] +aerospace resize [-h|--help] [--window-id ] (smart|width|height) [+|-] // end::synopsis[] @@ -31,12 +31,16 @@ Second argument controls how much the size is changes * If the `` is prefixed with `+` then the dimension is increased * If the `` is prefixed with `-` then the dimension is decreased * If the `` is prefixed with neither `+` nor `-` then the command changes the absolute value of the dimension -// end::body[] // =========================================================== Options -include::util/conditional-options-header.adoc[] +include::./util/conditional-options-header.adoc[] -h, --help:: Print help +--window-id :: +include::./util/window-id-flag-desc.adoc[] + +// end::body[] + // =========================================================== Footer include::util/man-footer.adoc[] diff --git a/docs/aerospace-split.adoc b/docs/aerospace-split.adoc index d453fccc..3b5fda85 100644 --- a/docs/aerospace-split.adoc +++ b/docs/aerospace-split.adoc @@ -9,7 +9,7 @@ include::util/man-attributes.adoc[] == Synopsis [verse] // tag::synopsis[] -aerospace split [-h|--help] (horizontal|vertical|opposite) +aerospace split [-h|--help] [--window-id ] (horizontal|vertical|opposite) // end::synopsis[] @@ -33,12 +33,16 @@ The argument configures orientation of the newly created container. IMPORTANT: `split` command has no effect if `enable-normalization-flatten-containers` is turned on. Consider using `join-with` if you want to keep `enable-normalization-flatten-containers` enabled -// end::body[] // =========================================================== Options include::util/conditional-options-header.adoc[] -h, --help:: Print help +--window-id :: +include::./util/window-id-flag-desc.adoc[] + +// end::body[] + // =========================================================== Footer include::util/man-footer.adoc[] diff --git a/docs/util/window-id-flag-desc.adoc b/docs/util/window-id-flag-desc.adoc new file mode 100644 index 00000000..6acca143 --- /dev/null +++ b/docs/util/window-id-flag-desc.adoc @@ -0,0 +1 @@ +Act on the window with specified `window-id` instead of the focused window diff --git a/docs/util/workspace-flag-desc.adoc b/docs/util/workspace-flag-desc.adoc new file mode 100644 index 00000000..f9bc0433 --- /dev/null +++ b/docs/util/workspace-flag-desc.adoc @@ -0,0 +1 @@ +Act on the specified workspace instead of the focused workspace diff --git a/grammar/commands-bnf-grammar.txt b/grammar/commands-bnf-grammar.txt index 34e43dab..b2e1016a 100644 --- a/grammar/commands-bnf-grammar.txt +++ b/grammar/commands-bnf-grammar.txt @@ -7,7 +7,7 @@ aerospace -h; ::= balance-sizes - | close [--quit-if-last-window] + | close [--quit-if-last-window|--window-id ]... | close-all-windows-but-current [--quit-if-last-window] @@ -27,39 +27,38 @@ aerospace -h; | focus-monitor [--wrap-around] (next|prev) [--wrap-around] | focus-monitor ... - | fullscreen [--no-outer-gaps] - | fullscreen [--no-outer-gaps|--fail-if-noop]... on [--no-outer-gaps|--fail-if-noop]... - | fullscreen [--fail-if-noop] off [--fail-if-noop] + | fullscreen [--no-outer-gaps|--window-id ]... + | fullscreen [--no-outer-gaps|--fail-if-noop|--window-id ]... on [--no-outer-gaps|--fail-if-noop|--window-id ]... + | fullscreen [--fail-if-noop|--window-id ] off [--fail-if-noop|--window-id ] | join-with (left|down|up|right) - | layout (h_tiles|v_tiles|h_accordion|v_accordion|tiles|accordion|horizontal|vertical|tiling|floating)... + | layout [--window-id ] (h_tiles|v_tiles|h_accordion|v_accordion|tiles|accordion|horizontal|vertical|tiling|floating)... - | macos-native-fullscreen - | macos-native-fullscreen [--fail-if-noop] (on|off) [--fail-if-noop] + | macos-native-fullscreen [--fail-if-noop|--window-id ]... [on|off] [--fail-if-noop|--window-id ]... | macos-native-minimize | mode - | move (left|down|up|right) + | move [--window-id ] (left|down|up|right) [--window-id ] | move-mouse [--fail-if-noop] (monitor-lazy-center|monitor-force-center|window-lazy-center|window-force-center) [--fail-if-noop] - | move-node-to-monitor [--wrap-around] (left|down|up|right) [--wrap-around] - | move-node-to-monitor [--wrap-around] (next|prev) [--wrap-around] + | move-node-to-monitor [--wrap-around|--window-id ] (left|down|up|right) [--wrap-around|--window-id ] + | move-node-to-monitor [--wrap-around|--window-id ] (next|prev) [--wrap-around|--window-id ] | move-node-to-monitor ... | move-node-to-workspace [--wrap-around] (next|prev) [--wrap-around] - | move-node-to-workspace [--fail-if-noop] [--fail-if-noop] + | move-node-to-workspace [--fail-if-noop|--window-id ] [--fail-if-noop|--window-id ] | move-workspace-to-monitor [--wrap-around] (next|prev) [--wrap-around] | reload-config [--no-gui | --dry-run]... - | resize (smart|width|height) [+|-] + | resize [--window-id ] (smart|width|height) [+|-] [--window-id ] - | split (horizontal|vertical|opposite) + | split [--window-id ] (horizontal|vertical|opposite) [--window-id ] | trigger-binding --mode | trigger-binding --mode