diff --git a/src/main.rs b/src/main.rs index a70143b..9810a57 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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) {