Skip to content

Run a command and wait for a sway/i3 window to appear

License

Notifications You must be signed in to change notification settings

rorosen/sway-toolwait

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sway Toolwait

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.

How to Build

nix build .\#packages.x86_64-linux.default

How to Run

Specify 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 alacritty

You 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 Alacritty

Use 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/dir

Check ./result/bin/sway-toolwait --help for all options.

Usage with Home Manager

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";
  }
];

About

Run a command and wait for a sway/i3 window to appear

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published