Skip to content

commands: accept 'next'/'prev' output names - #9128

Open
orestisfl wants to merge 1 commit into
swaywm:masterfrom
orestisfl:output-next-prev
Open

commands: accept 'next'/'prev' output names#9128
orestisfl wants to merge 1 commit into
swaywm:masterfrom
orestisfl:output-next-prev

Conversation

@orestisfl

Copy link
Copy Markdown
Contributor

move container to output, move workspace to output and focus output now accept 'next' and 'prev', which cycle through the enabled outputs with wrap-around. This matches i3's behaviour of expanding 'next' into the full output list so the following output relative to the current one is picked.

The name/direction/current resolution used by the move commands was also duplicated inline in focus_output; both call sites now share a new output_by_direction_or_name helper in sway/desktop/output.c.

Closes: #8799

i3 implementation in i3/i3#4338 Note:

  • i3 accepts multiple output arguments and next works as a wildcard. I considered that out of scope for this PR.
  • i3 does not have prev. Accepting it in sway is natural and practically free complexity-wise so I added it.

`move container to output`, `move workspace to output` and `focus
output` now accept 'next' and 'prev', which cycle through the enabled
outputs with wrap-around. This matches i3's behaviour of expanding
'next' into the full output list so the following output relative to
the current one is picked.

The name/direction/current resolution used by the move commands was
also duplicated inline in `focus_output`; both call sites now share a
new `output_by_direction_or_name` helper in `sway/desktop/output.c`.

Closes: swaywm#8799

i3 implementation in i3/i3#4338
Note:
- i3 accepts multiple output arguments and `next` works as a wildcard. I
  considered that out of scope for this PR.
- i3 does not have `prev`. Accepting it in sway is natural and
  practically free complexity-wise so I added it.
@emersion emersion added the i3-compat Sway doesn't match i3's behavior label Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

i3-compat Sway doesn't match i3's behavior

Development

Successfully merging this pull request may close these issues.

focus output does not support "next"

2 participants