Fix focus to group when no existing workspace

This commit is contained in:
Nabos 2022-08-23 15:14:19 +02:00
parent 72c34cb5e5
commit 4ec989ed72

View file

@ -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);