diff --git a/src/main.rs b/src/main.rs index c58f5fb..da0019b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -204,7 +204,7 @@ fn get_current_output_index(stream: &UnixStream) -> usize { let outputs = get_outputs(stream); match outputs.iter().position(|x| x.focused) { - Some(i) => i + 1, + Some(i) => i, None => panic!("WTF! No focused output???"), } } @@ -494,9 +494,9 @@ fn move_container_to_next_or_prev_output(stream: &UnixStream, go_to_prev: bool) let focused_output_index = get_current_output_index(stream); let target_output = if go_to_prev { - &outputs[(focused_output_index + outputs.len() - 1) % outputs.len() - 1] + &outputs[(focused_output_index + outputs.len() - 1) % outputs.len()] } else { - &outputs[(focused_output_index + 1) % outputs.len() - 1] + &outputs[(focused_output_index + 1) % outputs.len()] }; let workspaces = get_workspaces(stream); @@ -546,9 +546,13 @@ fn init_workspaces(stream: &UnixStream, workspace_index: usize) { send_command(stream, &cmd); let mut cmd: String = "workspace number ".to_string(); - let full_ws_name = format!("{}{}", get_current_output_index(stream), &workspace_index) - .parse::() - .unwrap(); + let full_ws_name = format!( + "{}{}", + get_current_output_index(stream) + 1, + &workspace_index + ) + .parse::() + .unwrap(); cmd.push_str(&full_ws_name.to_string()); send_command(stream, &cmd); }