From 5380131ee97531559887cfe65bffb11b53c646a5 Mon Sep 17 00:00:00 2001 From: Skia Date: Sun, 15 Jan 2023 11:11:03 +0100 Subject: [PATCH 1/2] Fix 'move_container_to_next_or_prev_output' and 'current_output_index' --- src/main.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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); } From 0566cf106ee80ad4d1067cc599c31eb6f3117391 Mon Sep 17 00:00:00 2001 From: Skia Date: Sun, 15 Jan 2023 11:15:01 +0100 Subject: [PATCH 2/2] README: fix '{next,prev}-output' and add 'Breaking changes' section --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index eb3179c..d9bb7ec 100644 --- a/README.md +++ b/README.md @@ -64,10 +64,10 @@ bindsym $mod+Shift+9 exec "swaysome move 9" bindsym $mod+Shift+0 exec "swaysome move 0" # Move focused container to next output -bindsym $mod+o exec "swaysome next_output" +bindsym $mod+o exec "swaysome next-output" # Move focused container to previous output -bindsym $mod+Shift+o exec "swaysome prev_output" +bindsym $mod+Shift+o exec "swaysome prev-output" # Init workspaces for every screen exec "swaysome init 1" @@ -90,9 +90,12 @@ as usual. ## Exhaustive swaysome commands list * `move [name]`: move the focused container to `[name]` -* `next_output`: move the focused container to the next output -* `prev_output`: move the focused container to the previous output +* `next-output`: move the focused container to the next output +* `prev-output`: move the focused container to the previous output * `focus [name]`: change focus to `[name]` * `focus_all_outputs [name]`: change all outputs focus to `[name]` * `init [name]`: cycle all outputs to create a default workspace with name `[name]` +## Breaking changes + +* Starting with 1.1.6, `next_output` and `prev_output` have been changed to `next-output` and `prev-output`.