-
-
Notifications
You must be signed in to change notification settings - Fork 152
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 --boundaries
options to move command
#864
Conversation
5592a0f
to
b274760
Compare
Currently switching between linux with Hyprland and macOS with Aerospace a lot and this is one of features I was missing the most, thanks a lot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the effort, but I reject the PR. Your understanding of the mental model of moving windows is incorrect. The PR is fundamentally wrong.
@@ -25,6 +26,17 @@ Deprecated name: `move-through` | |||
include::./util/conditional-options-header.adoc[] | |||
|
|||
-h, --help:: Print help | |||
--fail-if-noop:: Exit with a non-zero status if the window cannot move because it’s at the boundary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't read the code yet, but move
command cannot fail. Please read #183 thread
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only possible case when it can fail is --boundaries-action (stop|create-implicit-container|fail)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ve reviewed #183 and your feedback.
I’m a bit unsure about how to best design the arguments, but I’ll reconsider the approach.
`<boundary>` possible values: `(workspace|all-monitors-outer-frame)`. + | ||
The default is: `workspace` | ||
|
||
--focus-follows-window:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't read the code yet, but move
already always follows window, I don't understand why you need this flag
@@ -25,6 +26,17 @@ Deprecated name: `move-through` | |||
include::./util/conditional-options-header.adoc[] | |||
|
|||
-h, --help:: Print help | |||
--fail-if-noop:: Exit with a non-zero status if the window cannot move because it’s at the boundary | |||
--wrap-around:: Make it possible to wrap around the movement |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree on: --boundaries-action (stop|create-implicit-container|fail|wrap-around-the-workspace|wrap-around-all-monitors)
, but I don't think that --wrap-around
on its own is the right flag
@@ -56,6 +64,10 @@ private func moveOut(_ io: CmdIo, window: Window, direction: CardinalDirection) | |||
bindTo = parent | |||
bindToIndex = innerMostChild.ownIndex + direction.insertionOffset | |||
case .workspace(let parent): // create implicit container | |||
if !canMoveOutInDirection(window: window, direction: direction) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I read in the code, you disallow creating implicit containers when the window is moved along the axis of the rootTilingNode. This is wrong approach. It should be conditional behavior of --boundaries-action
By default it should always be possible to move out window out of container. Please, read #183 thread
public var workspaceName: WorkspaceName? | ||
public var failIfNoop: Bool = false | ||
public var rawBoundaries: Boundaries? = nil | ||
public var moveNodeToMonitor = MoveNodeToMonitorCmdArgs(rawArgs: []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't think a lot about it, but it may not be the right place to reuse move-node-to-monitor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t fully agree. MoveNodeToMonitorCommand
already calls MoveNodeToWorkspaceCommand
in a similar way. There might be other approaches, but I’m not sure yet.
let moveNodeToWorkspace = args.moveNodeToWorkspace.copy(\.target, .initialized(.direct(wName))) | |
return MoveNodeToWorkspaceCommand(args: moveNodeToWorkspace).run(env, io) |
Thanks for taking the time to review my PR. I appreciate your feedback and insights. I’ll revisit the approach based on your comments and open a new PR that aligns more closely with the intended mental model. |
Summary
This PR introduces a new
--boundaries
option to the move command, allowing windows to move beyond their current workspace.By default, window movements remain within a single workspace. With
--boundaries all-monitors-outer-frame
, windows can now be moved across multiple monitors for increased flexibility.Key Changes
move
Command Updates:--boundaries <boundary>
: Choose between staying within theworkspace
orall-monitors-outer-frame
.--wrap-around
: Cycle through monitors when reaching an edge.--focus-follows-window:
Automatically focus the moved window.--fail-if-noop
: Exit with a non-zero status if the window cannot move (e.g., hitting the boundary without--boundaries all-monitors-outer-frame
).Why?
These enhancements provide more control over window movement in multi-monitor setups and improve scripting scenarios by offering fail-fast behavior, wrap-around cycling, and automatic refocusing.
Example