Check for screen number

This commit is contained in:
Nabos 2022-08-05 12:56:00 +02:00
parent b39b51ad58
commit 6fe7ca7bc3

View file

@ -24,7 +24,7 @@ const GET_OUTPUTS: u32 = 3;
#[clap(propagate_version = true)]
struct Cli {
#[clap(subcommand)]
command: Command
command: Command,
}
#[derive(Subcommand, Debug)]
@ -54,19 +54,19 @@ enum Command {
#[derive(Args, Debug)]
struct InitAction {
#[clap(value_name = "index", help = "The index to initialize with")]
name: String
name: String,
}
#[derive(Args, Debug)]
struct FocusAction {
#[clap(value_name = "index", help = "The index to focus on")]
name: String
name: String,
}
#[derive(Args, Debug)]
struct MoveAction {
#[clap(value_name = "index", help = "The index to move the container to")]
name: String
name: String,
}
fn get_stream() -> UnixStream {
@ -313,9 +313,11 @@ fn rearrange_workspaces(stream: &UnixStream) {
send_command(stream, &focus_cmd);
let output_index = (workspace.num / 10) as usize;
let mut move_cmd = move_cmd_prefix.clone();
move_cmd.push_str(&outputs[output_index].name);
send_command(stream, &move_cmd);
if output_index < outputs.len() {
let mut move_cmd = move_cmd_prefix.clone();
move_cmd.push_str(&outputs[output_index].name);
send_command(stream, &move_cmd);
}
}
}