-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add unit ppt to 'move' + direction #8743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
#include "util.h" | ||
|
||
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 <container|window|workspace> [to] output <name|direction>' or " | ||
"'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( | ||
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; | ||
bool is_ppt = false; | ||
if (argc) { | ||
char *inv; | ||
move_amt = (int)strtol(argv[0], &inv, 10); | ||
if (*inv != '\0' && strcasecmp(inv, "px") != 0) { | ||
if (*inv != '\0') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like this doesn't accept the We already have a |
||
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; | ||
|
@@ -726,16 +734,16 @@ static struct cmd_results *cmd_move_in_direction( | |
double ly = container->pending.y; | ||
switch (direction) { | ||
case WLR_DIRECTION_LEFT: | ||
lx -= move_amt; | ||
lx -= is_ppt ? container->pending.width * ((double)move_amt / 100.0) : move_amt; | ||
break; | ||
case WLR_DIRECTION_RIGHT: | ||
lx += move_amt; | ||
lx += is_ppt ? container->pending.width * ((double)move_amt / 100.0) : move_amt; | ||
break; | ||
case WLR_DIRECTION_UP: | ||
ly -= move_amt; | ||
ly -= is_ppt ? container->pending.height * ((double)move_amt / 100.0) : move_amt; | ||
break; | ||
case WLR_DIRECTION_DOWN: | ||
ly += move_amt; | ||
ly += is_ppt ? container->pending.height * ((double)move_amt / 100.0) : move_amt; | ||
break; | ||
} | ||
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 " | ||
"'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" | ||
" <name>|next|prev|next_on_output|prev_on_output|current|(number <num>)'" | ||
" or 'move [window|container] [to] output <name/id>|left|right|up|down'" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -231,10 +231,11 @@ set|plus|minus|toggle <amount> | |
the per-output *allow_tearing* setting. See *sway-output*(5) | ||
for further details. | ||
|
||
*move* left|right|up|down [<px> px] | ||
Moves the focused container in the direction specified. The optional _px_ | ||
argument specifies how many pixels to move the container. If unspecified, | ||
the default is 10 pixels. Pixels are ignored when moving tiled containers. | ||
*move* left|right|up|down [<px> [px|ppt]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably should read |
||
Moves the focused container in the specified direction. The distance can be | ||
specified in pixels or percentage points, omitting the unit defaults to pixels. | ||
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] | ||
Moves the focused container to the specified position in the workspace. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remnant from debugging session?