Really simple tool that runs a sway exec command and waits on a specified workspace for a new window to appear. I use it to organize applications on workspaces during startup. Also works with i3.
nix build .\#packages.x86_64-linux.defaultSpecify at least the workspace and the exec command to run. This will just wait for any new window to appear, ignoring which window it is.
./result/bin/sway-toolwait --workspace 7 --command alacrittyYou can also use the --waitfor argument to pass an app_id (or instance string for xwayland) that
the new window must match. You can get it for example from the output of swaymsg -t get_tree.
./result/bin/sway-toolwait --workspace 7 --command alacritty --waitfor AlacrittyUse a trailing -- to specify additional arguments that are passed to the exec command.
./result/bin/sway-toolwait --workspace 7 --command alacritty --waitfor Alacritty -- --working-directory /my/work/dirCheck ./result/bin/sway-toolwait --help for all options.
Import the provided home manager module and use the wayland.windowManager.sway.toolwait option.
imports = [ inputs.sway-toolwait.homeManagerModules.default ];
wayland.windowManager.sway.toolwait = [
{
command = "${pkgs.firefox}/bin/firefox";
workspace = 1;
waitFor = "firefox";
}
{
command = "${pkgs.alacritty}/bin/alacritty";
workspace = 2;
waitFor = "Alacritty";
}
{
command = "${pkgs.keepassxc}/bin/keepassxc";
workspace = 10;
waitFor = "org.keepassxc.KeePassXC";
}
];