-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
Add features that are requested in issue #766 #831
Closed
franzl1096
wants to merge
1
commit into
nikitabobko:main
from
franzl1096:766/add-functionality-to-move-workspace-to-monitor-command
Closed
Add features that are requested in issue #766 #831
franzl1096
wants to merge
1
commit into
nikitabobko:main
from
franzl1096:766/add-functionality-to-move-workspace-to-monitor-command
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…biltities for moving their workspaces between monitors The "move-workspace-to-monitor" command provides now the requested features of Issue nikitabobko#766. This commit makes it possible to move workspaces to a specific monitor with a monitor pattern Additonally to the next|prev i have added the left|down|up|right option
Thanks! Merged with the additional patch: diff --git a/Sources/AppBundle/command/impl/MoveWorkspaceToMonitorCommand.swift b/Sources/AppBundle/command/impl/MoveWorkspaceToMonitorCommand.swift
index dc3b9000..890172d8 100644
--- a/Sources/AppBundle/command/impl/MoveWorkspaceToMonitorCommand.swift
+++ b/Sources/AppBundle/command/impl/MoveWorkspaceToMonitorCommand.swift
@@ -10,9 +10,7 @@ struct MoveWorkspaceToMonitorCommand: Command {
let focusedWorkspace = target.workspace
let prevMonitor = focusedWorkspace.workspaceMonitor
- switch args.target.val.resolve(
- target.workspace.workspaceMonitor, wrapAround: args.wrapAround)
- {
+ switch args.target.val.resolve(target.workspace.workspaceMonitor, wrapAround: args.wrapAround) {
case .success(let targetMonitor):
if targetMonitor.monitorId == prevMonitor.monitorId {
return true
diff --git a/Sources/Common/cmdArgs/impl/MoveWorkpsaceToMonitorCmdArgs.swift b/Sources/Common/cmdArgs/impl/MoveWorkpsaceToMonitorCmdArgs.swift
index a6d61870..27cb8577 100644
--- a/Sources/Common/cmdArgs/impl/MoveWorkpsaceToMonitorCmdArgs.swift
+++ b/Sources/Common/cmdArgs/impl/MoveWorkpsaceToMonitorCmdArgs.swift
@@ -11,8 +11,10 @@ public struct MoveWorkspaceToMonitorCmdArgs: CmdArgs {
],
arguments: [
newArgParser(
- \.target, parseTarget,
- mandatoryArgPlaceholder: "(left|down|up|right|next|prev|<monitor-pattern>)"),
+ \.target,
+ parseTarget,
+ mandatoryArgPlaceholder: "(left|down|up|right|next|prev|<monitor-pattern>)"
+ ),
]
)
@@ -21,9 +23,8 @@ public struct MoveWorkspaceToMonitorCmdArgs: CmdArgs {
public var wrapAround: Bool = false
public var target: Lateinit<MonitorTarget> = .uninitialized
}
-public func parseWorkspaceToMonitorCmdArgs(_ args: [String]) -> ParsedCmd<
- MoveWorkspaceToMonitorCmdArgs
-> {
+
+public func parseWorkspaceToMonitorCmdArgs(_ args: [String]) -> ParsedCmd<MoveWorkspaceToMonitorCmdArgs> {
parseSpecificCmdArgs(MoveWorkspaceToMonitorCmdArgs(rawArgs: args), args)
.filter("--wrap-around is incompatible with <monitor-pattern> argument") {
$0.wrapAround.implies(!$0.target.val.isPatterns)
diff --git a/Sources/Common/cmdHelpGenerated.swift b/Sources/Common/cmdHelpGenerated.swift
index 7975c475..390bc6e1 100644
--- a/Sources/Common/cmdHelpGenerated.swift
+++ b/Sources/Common/cmdHelpGenerated.swift
@@ -109,7 +109,8 @@ let move_node_to_workspace_help_generated = """
[--window-id <window-id>] <workspace-name>
"""
let move_workspace_to_monitor_help_generated = """
- USAGE: move-workspace-to-monitor [-h|--help] [--workspace <workspace>] [--wrap-around] (left|down|up|right|next|prev)
+ USAGE: move-workspace-to-monitor [-h|--help] [--workspace <workspace>] [--wrap-around] (left|down|up|right)
+ OR: move-workspace-to-monitor [-h|--help] [--workspace <workspace>] [--wrap-around] (next|prev)
OR: move-workspace-to-monitor [-h|--help] [--workspace <workspace>] <monitor-pattern>...
"""
let move_help_generated = """
diff --git a/docs/aerospace-move-workspace-to-monitor.adoc b/docs/aerospace-move-workspace-to-monitor.adoc
index 114c2f45..6b103ca4 100644
--- a/docs/aerospace-move-workspace-to-monitor.adoc
+++ b/docs/aerospace-move-workspace-to-monitor.adoc
@@ -9,7 +9,8 @@ include::util/man-attributes.adoc[]
== Synopsis
[verse]
// tag::synopsis[]
-aerospace move-workspace-to-monitor [-h|--help] [--workspace <workspace>] [--wrap-around] (left|down|up|right|next|prev)
+aerospace move-workspace-to-monitor [-h|--help] [--workspace <workspace>] [--wrap-around] (left|down|up|right)
+aerospace move-workspace-to-monitor [-h|--help] [--workspace <workspace>] [--wrap-around] (next|prev)
aerospace move-workspace-to-monitor [-h|--help] [--workspace <workspace>] <monitor-pattern>...
// end::synopsis[]
diff --git a/grammar/commands-bnf-grammar.txt b/grammar/commands-bnf-grammar.txt
index 891cfb85..30cca020 100644
--- a/grammar/commands-bnf-grammar.txt
+++ b/grammar/commands-bnf-grammar.txt
@@ -54,7 +54,8 @@ aerospace -h;
| move-node-to-workspace [--wrap-around|--focus-follows-window]... (next|prev) [--wrap-around|--focus-follows-window]...
| move-node-to-workspace [--fail-if-noop|--window-id <window_id>|--focus-follows-window]... <workspace> [--fail-if-noop|--window-id <window_id>|--focus-follows-window]...
- | move-workspace-to-monitor [--wrap-around] (next|prev) [--wrap-around]
+ | move-workspace-to-monitor [--wrap-around] (left|down|up|right|next|prev) [--wrap-around]
+ | move-workspace-to-monitor [--wrap-around] <monitor_pattern>... [--wrap-around]
| reload-config [--no-gui | --dry-run]...
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I added the capability to use a
<monitor-pattern>
in themove-workspace-to-monitor
command. A workspace is only moved if the source and target monitors are different. If the--wrap-around
flag is used in combination with a monitor pattern, an error is shown in the CLI. Additionally, I added the option to useleft|down|up|right
, similar to thefocus-monitor
command, to move a workspace relative to the current monitor.