aboutsummaryrefslogtreecommitdiff
path: root/sway/tree/root.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/root.c')
-rw-r--r--sway/tree/root.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/sway/tree/root.c b/sway/tree/root.c
index 1dabc287..55d78487 100644
--- a/sway/tree/root.c
+++ b/sway/tree/root.c
@@ -54,7 +54,7 @@ void root_destroy(struct sway_root *root) {
free(root);
}
-void root_scratchpad_add_container(struct sway_container *con) {
+void root_scratchpad_add_container(struct sway_container *con, struct sway_workspace *ws) {
if (!sway_assert(!con->scratchpad, "Container is already in scratchpad")) {
return;
}
@@ -77,18 +77,23 @@ void root_scratchpad_add_container(struct sway_container *con) {
container_detach(con);
con->scratchpad = true;
list_add(root->scratchpad, con);
-
- struct sway_seat *seat = input_manager_current_seat();
- struct sway_node *new_focus = NULL;
- if (parent) {
- arrange_container(parent);
- new_focus = seat_get_focus_inactive(seat, &parent->node);
+ if (ws) {
+ workspace_add_floating(ws, con);
}
- if (!new_focus) {
- arrange_workspace(workspace);
- new_focus = seat_get_focus_inactive(seat, &workspace->node);
+
+ if (!ws) {
+ struct sway_seat *seat = input_manager_current_seat();
+ struct sway_node *new_focus = NULL;
+ if (parent) {
+ arrange_container(parent);
+ new_focus = seat_get_focus_inactive(seat, &parent->node);
+ }
+ if (!new_focus) {
+ arrange_workspace(workspace);
+ new_focus = seat_get_focus_inactive(seat, &workspace->node);
+ }
+ seat_set_focus(seat, new_focus);
}
- seat_set_focus(seat, new_focus);
ipc_event_window(con, "move");
}