Skip to content

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

Open
gwhitney wants to merge 1 commit into
WillPower3309:masterfrom
gwhitney:move_keywords
Open

Allow move position command to calculate from right and/or bottom edge#523
gwhitney wants to merge 1 commit into
WillPower3309:masterfrom
gwhitney:move_keywords

Conversation

@gwhitney
Copy link
Copy Markdown

@gwhitney gwhitney commented Apr 30, 2026

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

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