diff --git a/src/main.rs b/src/main.rs index 658a4be..8c1f3bd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -434,7 +434,7 @@ fn focus_to_group(stream: &UnixStream, group_index: usize) { ), None => { // Or if the targeted output is currently connected - if group_index < outputs.len() { + if group_index <= outputs.len() { Some(group_index) } else { None @@ -445,7 +445,7 @@ fn focus_to_group(stream: &UnixStream, group_index: usize) { match target_screen_index { // If we have to send it to another screen Some(target_screen_index) => { - let target_output = &outputs[target_screen_index]; + let target_output = &outputs[target_screen_index - 1]; let mut focus_cmd: String = "focus output ".to_string(); focus_cmd.push_str(&target_output.name); @@ -565,7 +565,7 @@ fn rearrange_workspaces(stream: &UnixStream) { send_command(stream, &focus_cmd); let output_index = workspace.num / 10; - if output_index < outputs.len() { + if output_index <= outputs.len() { let mut move_cmd = move_cmd_prefix.clone(); move_cmd.push_str(&outputs[output_index - 1].name); send_command(stream, &move_cmd);