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

Added move-workspace-to-index and move-workspace-to-monitor IPC actions #1007

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Kirottu
Copy link

@Kirottu Kirottu commented Jan 18, 2025

No description provided.

@Kirottu Kirottu closed this Jan 18, 2025
@Kirottu Kirottu reopened this Jan 18, 2025
@Kirottu
Copy link
Author

Kirottu commented Jan 18, 2025

I must say I have genuinely no idea what happened to the previous PR, but GitHub has decided that it's just... not a part of the equation anymore after some problems with getting rebase done correctly. All the previous comments should have now been addressed. I am deeply sorry for the confusion this must be causing... well everyone.

@YaLTeR
Copy link
Owner

YaLTeR commented Jan 18, 2025

7 copilot buttons and none could save them

src/input/mod.rs Show resolved Hide resolved
src/input/mod.rs Outdated Show resolved Hide resolved
src/input/mod.rs Outdated Show resolved Hide resolved
src/input/mod.rs Show resolved Hide resolved
src/layout/mod.rs Outdated Show resolved Hide resolved
src/layout/mod.rs Outdated Show resolved Hide resolved
@YaLTeR YaLTeR force-pushed the rebased-workspace-actions branch from 90468b5 to 72afddb Compare January 23, 2025 08:27
Copy link
Owner

@YaLTeR YaLTeR left a comment

Choose a reason for hiding this comment

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

Rebased. Noticed two issues:

  1. Command like move-workspace-to-index 0 --reference 2 doesn't work because in this case find_output_and_workspace_index() returns a None output.
  2. Command like move-workspace-to-index 0 --reference browser focuses the workspace after moving it, even if it wasn't focused before.

@Kirottu
Copy link
Author

Kirottu commented Jan 23, 2025

Those should be fixed:

  1. In case a numbered workspace reference is used, the code now assumes the active monitor
  2. The active workspace index will now be adjusted through a few conditions as seen in the code

src/layout/monitor.rs Outdated Show resolved Hide resolved
src/input/mod.rs Show resolved Hide resolved
src/input/mod.rs Outdated Show resolved Hide resolved
@Kirottu
Copy link
Author

Kirottu commented Jan 23, 2025

Those problems should also be done, also fixed a bit of an issue where the active workspace on the monitor that had a workspace moved off it would be wrong if the workspace that was moved was not the active workspace.

src/layout/monitor.rs Outdated Show resolved Hide resolved
@@ -3884,11 +3898,20 @@ impl<W: LayoutElement> Layout<W> {
// the last empty workspace, then insert before.
let target_ws_idx = min(target.active_workspace_idx + 1, target.workspaces.len() - 1);
target.workspaces.insert(target_ws_idx, ws);
target.active_workspace_idx = target_ws_idx;
target.workspace_switch = None;
Copy link
Owner

Choose a reason for hiding this comment

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

This is also needed. Without it, the randomized test crashes:

thread 'layout::tests::random_operations_dont_panic' panicked at src/layout/mod.rs:7328:5:
Test failed: assertion failed: self.workspace_switch.is_none().
minimal failing input: ops = [
    AddOutput(
        3,
    ),
    AddOutput(
        2,
    ),
    AddNamedWorkspace {
        ws_name: 2,
        output_name: None,
    },
    AddWindow {
        params: TestWindowParams {
            id: 1,
            parent_id: None,
            is_floating: false,
            bbox: Rectangle<smithay::utils::geometry::Logical> {
                x: 0,
                y: 0,
                width: 1,
                height: 1,
            },
            min_max_size: (
                Size<smithay::utils::geometry::Logical> {
                    w: 0,
                    h: 0,
                },
                Size<smithay::utils::geometry::Logical> {
                    w: 0,
                    h: 0,
                },
            ),
        },
    },
    MoveWorkspaceToOutput(
        2,
    ),
    FocusWorkspaceAutoBackAndForth(
        0,
    ),
    MoveWorkspaceToMonitor {
        ws_name: Some(
            2,
        ),
        output_id: 2,
    },
]

Copy link
Author

Choose a reason for hiding this comment

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

Alright, reordered it to mirror the original order at which the operations were done.

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

Successfully merging this pull request may close these issues.

2 participants