mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 01:41:30 +00:00
Allow moving a container hidden in scratchpad
(as i3 allows it) Just update the container's coordinates so that they will be applied at the next show.
This commit is contained in:
parent
ff7d979d99
commit
7baa3ffece
|
@ -675,10 +675,6 @@ static struct cmd_results *cmd_move_in_direction(
|
||||||
return cmd_results_new(CMD_FAILURE,
|
return cmd_results_new(CMD_FAILURE,
|
||||||
"Cannot move workspaces in a direction");
|
"Cannot move workspaces in a direction");
|
||||||
}
|
}
|
||||||
if (container_is_scratchpad_hidden(container)) {
|
|
||||||
return cmd_results_new(CMD_FAILURE,
|
|
||||||
"Cannot move a hidden scratchpad container");
|
|
||||||
}
|
|
||||||
if (container_is_floating(container)) {
|
if (container_is_floating(container)) {
|
||||||
if (container->fullscreen_mode) {
|
if (container->fullscreen_mode) {
|
||||||
return cmd_results_new(CMD_FAILURE,
|
return cmd_results_new(CMD_FAILURE,
|
||||||
|
@ -750,10 +746,6 @@ static struct cmd_results *cmd_move_to_position(int argc, char **argv) {
|
||||||
return cmd_results_new(CMD_FAILURE, "Only floating containers "
|
return cmd_results_new(CMD_FAILURE, "Only floating containers "
|
||||||
"can be moved to an absolute position");
|
"can be moved to an absolute position");
|
||||||
}
|
}
|
||||||
if (container_is_scratchpad_hidden(container)) {
|
|
||||||
return cmd_results_new(CMD_FAILURE,
|
|
||||||
"Cannot move a hidden scratchpad container");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!argc) {
|
if (!argc) {
|
||||||
return cmd_results_new(CMD_INVALID, expected_position_syntax);
|
return cmd_results_new(CMD_INVALID, expected_position_syntax);
|
||||||
|
@ -795,6 +787,10 @@ static struct cmd_results *cmd_move_to_position(int argc, char **argv) {
|
||||||
ly = root->y + (root->height - container->height) / 2;
|
ly = root->y + (root->height - container->height) / 2;
|
||||||
} else {
|
} else {
|
||||||
struct sway_workspace *ws = container->workspace;
|
struct sway_workspace *ws = container->workspace;
|
||||||
|
if (!ws) {
|
||||||
|
struct sway_seat *seat = config->handler_context.seat;
|
||||||
|
ws = seat_get_focused_workspace(seat);
|
||||||
|
}
|
||||||
lx = ws->x + (ws->width - container->width) / 2;
|
lx = ws->x + (ws->width - container->width) / 2;
|
||||||
ly = ws->y + (ws->height - container->height) / 2;
|
ly = ws->y + (ws->height - container->height) / 2;
|
||||||
}
|
}
|
||||||
|
@ -828,8 +824,13 @@ static struct cmd_results *cmd_move_to_position(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!absolute) {
|
if (!absolute) {
|
||||||
lx += container->workspace->x;
|
struct sway_workspace *ws = container->workspace;
|
||||||
ly += container->workspace->y;
|
if (!ws) {
|
||||||
|
struct sway_seat *seat = config->handler_context.seat;
|
||||||
|
ws = seat_get_focused_workspace(seat);
|
||||||
|
}
|
||||||
|
lx += ws->x;
|
||||||
|
ly += ws->y;
|
||||||
}
|
}
|
||||||
container_floating_move_to(container, lx, ly);
|
container_floating_move_to(container, lx, ly);
|
||||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||||
|
|
|
@ -880,6 +880,9 @@ void container_floating_move_to(struct sway_container *con,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
container_floating_translate(con, lx - con->x, ly - con->y);
|
container_floating_translate(con, lx - con->x, ly - con->y);
|
||||||
|
if (container_is_scratchpad_hidden(con)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
struct sway_workspace *old_workspace = con->workspace;
|
struct sway_workspace *old_workspace = con->workspace;
|
||||||
struct sway_output *new_output = container_floating_find_output(con);
|
struct sway_output *new_output = container_floating_find_output(con);
|
||||||
if (!sway_assert(new_output, "Unable to find any output")) {
|
if (!sway_assert(new_output, "Unable to find any output")) {
|
||||||
|
|
Loading…
Reference in a new issue