mirror of
https://gitlab.com/hyask/swaysome.git
synced 2026-01-28 02:17:18 +01:00
Check for screen number
This commit is contained in:
parent
b39b51ad58
commit
6fe7ca7bc3
1 changed files with 9 additions and 7 deletions
16
src/main.rs
16
src/main.rs
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue