diff options
author | lbonn <bonnans.l@gmail.com> | 2019-08-20 00:01:17 +0200 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2019-08-20 13:09:52 -0400 |
commit | 7baa3ffece882cc1fa1b5281dcf85575a429e820 (patch) | |
tree | 2fad9e6ba119f4d11e8ccdd906c2abd96f723bd6 /sway/commands/move.c | |
parent | cmd_xwayland: add force for immediate launch (diff) | |
download | sway-7baa3ffece882cc1fa1b5281dcf85575a429e820.tar.gz sway-7baa3ffece882cc1fa1b5281dcf85575a429e820.tar.zst sway-7baa3ffece882cc1fa1b5281dcf85575a429e820.zip |
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.
Diffstat (limited to 'sway/commands/move.c')
-rw-r--r-- | sway/commands/move.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c index 5779b431..99215ffc 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c | |||
@@ -675,10 +675,6 @@ static struct cmd_results *cmd_move_in_direction( | |||
675 | return cmd_results_new(CMD_FAILURE, | 675 | return cmd_results_new(CMD_FAILURE, |
676 | "Cannot move workspaces in a direction"); | 676 | "Cannot move workspaces in a direction"); |
677 | } | 677 | } |
678 | if (container_is_scratchpad_hidden(container)) { | ||
679 | return cmd_results_new(CMD_FAILURE, | ||
680 | "Cannot move a hidden scratchpad container"); | ||
681 | } | ||
682 | if (container_is_floating(container)) { | 678 | if (container_is_floating(container)) { |
683 | if (container->fullscreen_mode) { | 679 | if (container->fullscreen_mode) { |
684 | return cmd_results_new(CMD_FAILURE, | 680 | return cmd_results_new(CMD_FAILURE, |
@@ -750,10 +746,6 @@ static struct cmd_results *cmd_move_to_position(int argc, char **argv) { | |||
750 | return cmd_results_new(CMD_FAILURE, "Only floating containers " | 746 | return cmd_results_new(CMD_FAILURE, "Only floating containers " |
751 | "can be moved to an absolute position"); | 747 | "can be moved to an absolute position"); |
752 | } | 748 | } |
753 | if (container_is_scratchpad_hidden(container)) { | ||
754 | return cmd_results_new(CMD_FAILURE, | ||
755 | "Cannot move a hidden scratchpad container"); | ||
756 | } | ||
757 | 749 | ||
758 | if (!argc) { | 750 | if (!argc) { |
759 | return cmd_results_new(CMD_INVALID, expected_position_syntax); | 751 | 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) { | |||
795 | ly = root->y + (root->height - container->height) / 2; | 787 | ly = root->y + (root->height - container->height) / 2; |
796 | } else { | 788 | } else { |
797 | struct sway_workspace *ws = container->workspace; | 789 | struct sway_workspace *ws = container->workspace; |
790 | if (!ws) { | ||
791 | struct sway_seat *seat = config->handler_context.seat; | ||
792 | ws = seat_get_focused_workspace(seat); | ||
793 | } | ||
798 | lx = ws->x + (ws->width - container->width) / 2; | 794 | lx = ws->x + (ws->width - container->width) / 2; |
799 | ly = ws->y + (ws->height - container->height) / 2; | 795 | ly = ws->y + (ws->height - container->height) / 2; |
800 | } | 796 | } |
@@ -828,8 +824,13 @@ static struct cmd_results *cmd_move_to_position(int argc, char **argv) { | |||
828 | } | 824 | } |
829 | 825 | ||
830 | if (!absolute) { | 826 | if (!absolute) { |
831 | lx += container->workspace->x; | 827 | struct sway_workspace *ws = container->workspace; |
832 | ly += container->workspace->y; | 828 | if (!ws) { |
829 | struct sway_seat *seat = config->handler_context.seat; | ||
830 | ws = seat_get_focused_workspace(seat); | ||
831 | } | ||
832 | lx += ws->x; | ||
833 | ly += ws->y; | ||
833 | } | 834 | } |
834 | container_floating_move_to(container, lx, ly); | 835 | container_floating_move_to(container, lx, ly); |
835 | return cmd_results_new(CMD_SUCCESS, NULL); | 836 | return cmd_results_new(CMD_SUCCESS, NULL); |