Skip to content

Commit

Permalink
cmd_move: add support for output current
Browse files Browse the repository at this point in the history
This adds support for the following commands for i3 compatibility:
- `move [window|container] [to] output current`
- `move workspace to [output] current`
- `move workspace [to] output current`

The above commands are only useful when used with criteria.
  • Loading branch information
RedSoxFan authored and ddevault committed Apr 30, 2019
1 parent 3b3e056 commit 13cbb3b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions sway/commands/move.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ static const char expected_syntax[] =

static struct sway_output *output_in_direction(const char *direction_string,
struct sway_output *reference, int ref_lx, int ref_ly) {
if (strcasecmp(direction_string, "current") == 0) {
struct sway_workspace *active_ws =
seat_get_focused_workspace(config->handler_context.seat);
if (!active_ws) {
return NULL;
}
return active_ws->output;
}

struct {
char *name;
enum wlr_direction direction;
Expand Down
6 changes: 3 additions & 3 deletions sway/sway.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ set|plus|minus <amount>
*move* [container|window] [to] workspace back_and_forth
Moves the focused container to previously focused workspace.

*move* [container|window] [to] output <name-or-id>
*move* [container|window] [to] output <name-or-id>|current
Moves the focused container to the specified output.

*move* [container|window] [to] output up|right|down|left
Expand All @@ -216,10 +216,10 @@ set|plus|minus <amount>
*move* [container|window] [to] scratchpad
Moves the focused container to the scratchpad.

*move* workspace [to] output <name-or-id>
*move* workspace [to] output <name-or-id>|current
Moves the focused workspace to the specified output.

*move* workspace to [output] <name-or-id>
*move* workspace to [output] <name-or-id>|current
Moves the focused workspace to the specified output.

*move* workspace [to] output up|right|down|left
Expand Down

0 comments on commit 13cbb3b

Please sign in to comment.