Skip to content
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: move all window to specific workspace #810

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Muffeter
Copy link

#750

This PR implements a new feature allowing users to move all windows to a specified workspace using custom key bindings.

usage:

  - commands: ["move-all --workspace 1"]
    bindings: ["alt+q+1"]

@@ -188,6 +189,7 @@ pub enum InvokeCommand {
#[clap(long)]
direction: Direction,
},
MoveAll(InvokeMoveCommand),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using the InvokeMoveCommand here will cause its flags to show as flags for move-all (e.g. move-all --direction <direction> even though that's not implemented)

would suggest creating a separate struct for move-all's arguments

config: &UserConfig,
) -> anyhow::Result<()> {
let current_workspace = window.workspace().context("No workspace.")?;
let _ = current_workspace
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should instead loop over the top-level children of the workspace (this will include both windows + split containers) and call move_container_within_tree on them to the target workspace.

pseudo-code:

let current_workspace = ...
let target_workspace = ...
let children = current_workspace.children();

for children {
  // move workspace children to target workspace
  move_container_within_tree( ...)

  // yoinked from L44-52 of `move_workspace_in_direction.rs`
  window.set_has_pending_dpi_adjustment(true);
  
  window.set_floating_placement(
    window
      .floating_placement()
      .translate_to_center(&workspace.to_rect()?),
  );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📬 Needs triage
Development

Successfully merging this pull request may close these issues.

2 participants