Skip to content

Allow move position command to calculate from right and/or bottom edge - #523

Open
gwhitney wants to merge 2 commits into
wlrfx:masterfrom
gwhitney:move_keywords
Open

gwhitney wants to merge 2 commits into
wlrfx:masterfrom
gwhitney:move_keywords

Conversation

@gwhitney

@gwhitney gwhitney commented Apr 30, 2026

Copy link
Copy Markdown

Unlike Xorg geometry specifications (e.g. 80x30-10-10) or CSS specifications (using right and bottom properties), prior to this PR SwayFX has no way to specify a window position as an offset to the right edge or bottom edge of its containing workspace. However, it is convenient to have such a mechanism for positioning a window in, say, the bottom right corner of the screen.

This PR adds optional left/right and top/bottom keywords before each dimension of the move position <dim> <dim> command. To preserve the behavior of existing config files/sway commands, omitted keywords on each dimension behave like left and top respectively.

Note that partial credit for this PR should go to @cizra, who filed a similar PR with sway itself. If the sway team shows interest in the somewhat refined version as filed here, we will likely file a very similar or identical PR to sway.

I wasn't sure if there were any other steps in generating a PR besides the code and documentation changes in the one commit of this PR? I didn't see any test suite that I should add to. If there are other tasks, please just let me know. In any case, this change can be tested by issuing a variety of swaymsg commands, such as:

swaymsg move position left 10 bottom 10
swaymsg move position right 0 top 10
swaymsg -- move position -5 top -5
swaymsg move position right 10ppt 20ppt
swaymsg move position 3px 5px

@gwhitney

Copy link
Copy Markdown
Author

As suspected, a roughly similar but simpler proposal (swaywm/sway#9058) was rejected by Sway. So it would be great if a maintainer here, even without necessarily yet reviewing this particular PR, could provide some guidance on whether SwayFX is a project amenable to backwards-compatible extensions like this (and for a somewhat more extensive one, please also see #522). If so, happy to wait until there's maintainer time to address the specifics of these proposals, but if these sorts of proposals/PRs are going to be d.o.a. because of straying too far from sway itself (which by its charter, hews precisely to i3), then I can shift effort to finding or creating another project where they can find a home. Thanks so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant