Correctly wrap around when changing workspace group

Fix #19
This commit is contained in:
Skia 2024-10-12 15:33:47 +01:00
parent df9b26335f
commit c5930274e5

View file

@ -652,11 +652,22 @@ impl SwaySome {
let current_workspace_index: usize = self.get_current_workspace_index();
let focused_group_index = current_workspace_index / MAX_GROUP_WS;
let highest_group = self.workspaces.last().unwrap().num / MAX_GROUP_WS;
let target_group;
if go_to_prev {
self.focus_to_group(focused_group_index - 1);
if focused_group_index == 0 {
target_group = highest_group;
} else {
target_group = focused_group_index - 1;
}
} else {
self.focus_to_group(focused_group_index + 1);
if focused_group_index >= highest_group {
target_group = 0;
} else {
target_group = focused_group_index + 1;
}
};
self.focus_to_group(target_group);
}
fn init_workspaces(&self, workspace_index: usize) {