From dcb5222ee26f0a711f34bff6024578e870c87f24 Mon Sep 17 00:00:00 2001 From: Skia Date: Tue, 2 Mar 2021 18:08:36 +0100 Subject: [PATCH] Add argument to init, to avoir hardcoded default workspace --- README.md | 2 +- src/main.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index da95865..d97b038 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ bindsym $mod+o exec "swaysome next_output" bindsym $mod+Shift+o exec "swaysome prev_output" # Init workspaces for every screen -exec "swaysome init" +exec "swaysome init 1" ``` Finally append your `sway` configuration with this: diff --git a/src/main.rs b/src/main.rs index d1664e4..38afae3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -224,7 +224,7 @@ fn move_container_to_next_or_prev_output(stream: &UnixStream, go_to_prev: bool) check_success(&stream); } -fn init_workspaces(stream: &UnixStream) { +fn init_workspaces(stream: &UnixStream, workspace_name: &String) { let outputs = get_outputs(&stream); let cmd_prefix: String = "focus output ".to_string(); @@ -234,7 +234,7 @@ fn init_workspaces(stream: &UnixStream) { println!("Sending command: '{}'", &cmd); send_msg(&stream, RUN_COMMAND, &cmd); 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(); match args[1].as_str() { - "init" => init_workspaces(&stream), + "init" => init_workspaces(&stream, &args[2]), "move" => move_container_to_workspace(&stream, &args[2]), "focus" => focus_to_workspace(&stream, &args[2]), "focus_all_outputs" => focus_all_outputs_to_workspace(&stream, &args[2]),