mirror of
https://github.com/swaywm/sway.git
synced 2025-10-08 21:25:58 +00:00
Merge b690b99847
into 90d3270970
This commit is contained in:
commit
3ffaafccf8
2 changed files with 20 additions and 11 deletions
|
@ -22,7 +22,7 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
static const char expected_syntax[] =
|
static const char expected_syntax[] =
|
||||||
"Expected 'move <left|right|up|down> <[px] px>' or "
|
"Expected 'move <left|right|up|down> [<amount> [px|ppt]]' or "
|
||||||
"'move [--no-auto-back-and-forth] <container|window> [to] workspace <name>' or "
|
"'move [--no-auto-back-and-forth] <container|window> [to] workspace <name>' or "
|
||||||
"'move <container|window|workspace> [to] output <name|direction>' or "
|
"'move <container|window|workspace> [to] output <name|direction>' or "
|
||||||
"'move <container|window> [to] mark <mark>'";
|
"'move <container|window> [to] mark <mark>'";
|
||||||
|
@ -703,13 +703,21 @@ static struct cmd_results *cmd_move_workspace(int argc, char **argv) {
|
||||||
|
|
||||||
static struct cmd_results *cmd_move_in_direction(
|
static struct cmd_results *cmd_move_in_direction(
|
||||||
enum wlr_direction direction, int argc, char **argv) {
|
enum wlr_direction direction, int argc, char **argv) {
|
||||||
|
//DEBUG
|
||||||
|
for (int i = 0; i < argc; i++) {
|
||||||
|
printf("argv[%d]: %s\n", i, argv[i]);
|
||||||
|
}
|
||||||
int move_amt = 10;
|
int move_amt = 10;
|
||||||
|
bool is_ppt = false;
|
||||||
if (argc) {
|
if (argc) {
|
||||||
char *inv;
|
char *inv;
|
||||||
move_amt = (int)strtol(argv[0], &inv, 10);
|
move_amt = (int)strtol(argv[0], &inv, 10);
|
||||||
if (*inv != '\0' && strcasecmp(inv, "px") != 0) {
|
if (*inv != '\0') {
|
||||||
return cmd_results_new(CMD_FAILURE, "Invalid distance specified");
|
return cmd_results_new(CMD_FAILURE, "Invalid distance specified");
|
||||||
}
|
}
|
||||||
|
if (argc > 1 && strcasecmp(argv[1], "ppt") == 0) {
|
||||||
|
is_ppt = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sway_container *container = config->handler_context.container;
|
struct sway_container *container = config->handler_context.container;
|
||||||
|
@ -726,16 +734,16 @@ static struct cmd_results *cmd_move_in_direction(
|
||||||
double ly = container->pending.y;
|
double ly = container->pending.y;
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case WLR_DIRECTION_LEFT:
|
case WLR_DIRECTION_LEFT:
|
||||||
lx -= move_amt;
|
lx -= is_ppt ? container->pending.width * ((double)move_amt / 100.0) : move_amt;
|
||||||
break;
|
break;
|
||||||
case WLR_DIRECTION_RIGHT:
|
case WLR_DIRECTION_RIGHT:
|
||||||
lx += move_amt;
|
lx += is_ppt ? container->pending.width * ((double)move_amt / 100.0) : move_amt;
|
||||||
break;
|
break;
|
||||||
case WLR_DIRECTION_UP:
|
case WLR_DIRECTION_UP:
|
||||||
ly -= move_amt;
|
ly -= is_ppt ? container->pending.height * ((double)move_amt / 100.0) : move_amt;
|
||||||
break;
|
break;
|
||||||
case WLR_DIRECTION_DOWN:
|
case WLR_DIRECTION_DOWN:
|
||||||
ly += move_amt;
|
ly += is_ppt ? container->pending.height * ((double)move_amt / 100.0) : move_amt;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
container_floating_move_to(container, lx, ly);
|
container_floating_move_to(container, lx, ly);
|
||||||
|
@ -981,7 +989,7 @@ static struct cmd_results *cmd_move_to_scratchpad(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char expected_full_syntax[] = "Expected "
|
static const char expected_full_syntax[] = "Expected "
|
||||||
"'move left|right|up|down [<amount> [px]]'"
|
"'move left|right|up|down [<amount> [px|ppt]]'"
|
||||||
" or 'move [--no-auto-back-and-forth] [window|container] [to] workspace"
|
" or 'move [--no-auto-back-and-forth] [window|container] [to] workspace"
|
||||||
" <name>|next|prev|next_on_output|prev_on_output|current|(number <num>)'"
|
" <name>|next|prev|next_on_output|prev_on_output|current|(number <num>)'"
|
||||||
" or 'move [window|container] [to] output <name/id>|left|right|up|down'"
|
" or 'move [window|container] [to] output <name/id>|left|right|up|down'"
|
||||||
|
|
|
@ -231,10 +231,11 @@ set|plus|minus|toggle <amount>
|
||||||
the per-output *allow_tearing* setting. See *sway-output*(5) for further
|
the per-output *allow_tearing* setting. See *sway-output*(5) for further
|
||||||
details.
|
details.
|
||||||
|
|
||||||
*move* left|right|up|down [<px> px]
|
*move* left|right|up|down [<px> [px|ppt]]
|
||||||
Moves the focused container in the direction specified. The optional _px_
|
Moves the focused container in the specified direction. The distance can be
|
||||||
argument specifies how many pixels to move the container. If unspecified,
|
specified in pixels or percentage points, omitting the unit defaults to pixels.
|
||||||
the default is 10 pixels. Pixels are ignored when moving tiled containers.
|
If unspecified, the default is 10 pixels. Pixels are ignored when moving tiled
|
||||||
|
containers.
|
||||||
|
|
||||||
*move* [absolute] position <pos_x> [px|ppt] <pos_y> [px|ppt]
|
*move* [absolute] position <pos_x> [px|ppt] <pos_y> [px|ppt]
|
||||||
Moves the focused container to the specified position in the workspace.
|
Moves the focused container to the specified position in the workspace.
|
||||||
|
|
Loading…
Add table
Reference in a new issue