Skip to content

Commit 13cbb3b

Browse files
RedSoxFanddevault
authored andcommitted
cmd_move: add support for output current
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.
1 parent 3b3e056 commit 13cbb3b

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

sway/commands/move.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ static const char expected_syntax[] =
2828

2929
static struct sway_output *output_in_direction(const char *direction_string,
3030
struct sway_output *reference, int ref_lx, int ref_ly) {
31+
if (strcasecmp(direction_string, "current") == 0) {
32+
struct sway_workspace *active_ws =
33+
seat_get_focused_workspace(config->handler_context.seat);
34+
if (!active_ws) {
35+
return NULL;
36+
}
37+
return active_ws->output;
38+
}
39+
3140
struct {
3241
char *name;
3342
enum wlr_direction direction;

sway/sway.5.scd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ set|plus|minus <amount>
206206
*move* [container|window] [to] workspace back_and_forth
207207
Moves the focused container to previously focused workspace.
208208

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

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

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

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

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

0 commit comments

Comments
 (0)