/swayrst

Restore workspaces in sway to displays and move applications to saved workspaces

Primary LanguagePythonMIT LicenseMIT

swayrst

Called sway-workspaces before
Restore workspaces in sway to displays and move already open windows to their workspaces.

Setup

  1. Download
    • Either from AUR with yay -S swayrst-git
    • Or download from Actions or Releases
      • unzip and chmod +x the file
  2. Setup displays, e.g. with swaymsg output ... or a GUI tool
  3. Move the windows to your desired workspaces
  4. Run swayrst save <profilename>
  5. Repeat with another profilename for every display setup (desk, mobile, work)
  6. Run swayrst load <profilename> to restore
  7. Make kanshi or shikane run this command for more automation

Development

Used objects in tree

  • output in workspace is replaced with the display name
  • The nodes list is used. All workspaces are in outputs (displays)
    • Windows are in a list in workspaces
  • Windows can be nested indefinitely, so node_getter() is used
    • This can happen if the user changes the layout of single windows, hence creates a new container
  • Workspace to output mapping are saved separately from the sway tree json
  • We get the information about which window is in which workspace from the tree: i3.get_tree(), swaymsg -t get_tree
  • There is no known way (to me) to identify the exact same windows after a reboot (to move multiple windows of the same tool)
    • window is only set for Xwayland windows - and is reset after a reboot
    • node IDs reset after a reboot