Add argument to init, to avoir hardcoded default workspace

This commit is contained in:
Skia 2021-03-02 18:08:36 +01:00
parent dfee3d9bbb
commit dcb5222ee2
2 changed files with 4 additions and 4 deletions

View file

@ -69,7 +69,7 @@ bindsym $mod+o exec "swaysome next_output"
bindsym $mod+Shift+o exec "swaysome prev_output" bindsym $mod+Shift+o exec "swaysome prev_output"
# Init workspaces for every screen # Init workspaces for every screen
exec "swaysome init" exec "swaysome init 1"
``` ```
Finally append your `sway` configuration with this: Finally append your `sway` configuration with this:

View file

@ -224,7 +224,7 @@ fn move_container_to_next_or_prev_output(stream: &UnixStream, go_to_prev: bool)
check_success(&stream); check_success(&stream);
} }
fn init_workspaces(stream: &UnixStream) { fn init_workspaces(stream: &UnixStream, workspace_name: &String) {
let outputs = get_outputs(&stream); let outputs = get_outputs(&stream);
let cmd_prefix: String = "focus output ".to_string(); let cmd_prefix: String = "focus output ".to_string();
@ -234,7 +234,7 @@ fn init_workspaces(stream: &UnixStream) {
println!("Sending command: '{}'", &cmd); println!("Sending command: '{}'", &cmd);
send_msg(&stream, RUN_COMMAND, &cmd); send_msg(&stream, RUN_COMMAND, &cmd);
check_success(&stream); check_success(&stream);
focus_to_workspace(&stream, &"1".to_string()); focus_to_workspace(&stream, &workspace_name);
} }
} }
@ -246,7 +246,7 @@ fn main() {
let stream = get_stream(); let stream = get_stream();
match args[1].as_str() { match args[1].as_str() {
"init" => init_workspaces(&stream), "init" => init_workspaces(&stream, &args[2]),
"move" => move_container_to_workspace(&stream, &args[2]), "move" => move_container_to_workspace(&stream, &args[2]),
"focus" => focus_to_workspace(&stream, &args[2]), "focus" => focus_to_workspace(&stream, &args[2]),
"focus_all_outputs" => focus_all_outputs_to_workspace(&stream, &args[2]), "focus_all_outputs" => focus_all_outputs_to_workspace(&stream, &args[2]),