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 #947

Closed
wants to merge 0 commits into from

Conversation

Kirottu
Copy link
Contributor

@Kirottu Kirottu commented Jan 8, 2025

Title says it all, this allows for more scriptability in workspace handling (moving specific workspaces to specific locations when needed) without relying on only moving the active workspace.

Closes #942.

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.

Sorry it took a while to get to this

niri-ipc/src/lib.rs Outdated Show resolved Hide resolved
niri-ipc/src/lib.rs Outdated Show resolved Hide resolved
niri-ipc/src/lib.rs Outdated Show resolved Hide resolved
niri-ipc/src/lib.rs Outdated Show resolved Hide resolved
niri-ipc/src/lib.rs Outdated Show resolved Hide resolved
src/layout/monitor.rs Outdated Show resolved Hide resolved
@@ -3745,6 +3745,77 @@ impl<W: LayoutElement> Layout<W> {
monitor.move_workspace_up();
}

pub fn move_workspace_to_idx(&mut self, output: Output, old_idx: usize, new_idx: usize) {
Copy link
Owner

Choose a reason for hiding this comment

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

Please add an entry for this into the Op enum in the tests module at the bottom of the file for randomized tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I also create test cases or will adding them to the enum do?

Copy link
Owner

Choose a reason for hiding this comment

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

Adding them to the enum will already suffice, but adding test cases for the tricky edge cases would be welcome. When doing that I usually comment out the relevant edge case to verify that the unit test will fail.

src/layout/mod.rs Outdated Show resolved Hide resolved
src/layout/mod.rs Outdated Show resolved Hide resolved
monitor.move_workspace_to_idx(old_idx, new_idx);
}

pub fn move_workspace_to_output_by_id(
Copy link
Owner

Choose a reason for hiding this comment

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

Also please add into Op.

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.

Workspaces sometimes get scrambled after monitor hotplugging
2 participants