Let your tiling windows fly free.
Tiling windows in Sway/i3 can't be sticky, so they're normally always stuck to a
single workspace. sway-antigrav fixes this by allowing windows to
automatically follow your focus as you switch workspaces. It does this by
swapping the chosen window with some specially tagged placeholder windows on any
workspaces that you want the window to follow you to.
This is a sort of natural compliment to one of my other projects,
sway-gravity. This program
allows tiling windows to move a little more freely than they typically would,
and sway-gravity constrains the placement of floating windows to make them a
bit easier to use effectively.
cargo install --git https://github.com/loganswartz/sway-antigravCurrently, this program is very much a POC, so there's not any CLI logic set up
yet. Run the daemon with sway-antigrav and leave it running.
In order for sway-antigrav to manage windows, they need to have certain marks
applied to them. There are 2 types of windows: "main", and "placeholder". When
you set up the window marks, you'll essentially assign windows to "groups",
where a group is just a number of your choosing. Each group should have exactly
1 main window, and any number of placeholders. When you switch to a workspace
that has a placeholder in it, the main window of that group will be swapped with
the placeholder.
Main windows get a mark in the format of antigrav-<group number>, and
placeholder windows get a mark in the format of antigrav-<group number>-<placeholder number>. The placeholder number is just something to
make the placeholder mark unique, as Sway/i3 doesn't allow you to assign
duplicate marks to multiple windows.
Once you have your windows properly marked and the daemon is running, it should automatically start swapping the main window around as you switch workspaces.
Currently, it'll also automatically resize all managed windows to their supposed
"natural" aspect ratio (as reported by their geometry rect), but eventually
this will be optional via a CLI toggle. I mainly built this for managing video
windows created by Firefox's PiP mode, which is why it currently happens
automatically.
This started as a 1-to-1 Rust port of i3-sticky. This is mainly because I have increasingly little patience for Python dependency management (and I say that as someone who's done a fair amount of projects in Python). As a Rust project, it's much easier to build and install as a single binary that will just work.
sway-antigrav doesn't currently implement all features of i3-sticky, and I
also have some plans for future features, beyond what i3-sticky offers.