@@ -257,7 +257,25 @@ static void container_move_to_container(struct sway_container *container,
257
257
if (destination -> view ) {
258
258
container_add_sibling (destination , container , 1 );
259
259
} else {
260
- container_add_child (destination , container );
260
+ /* For split containers, we use the currently focused container within it.
261
+ * This allows setting marks on, e.g., tabbed containers which will move
262
+ * con to a new tab behind the focused tab. */
263
+ sway_log (SWAY_DEBUG , "target is a split container, descending to the currently focused child." );
264
+ struct sway_node * focused = seat_get_active_tiling_child (
265
+ config -> handler_context .seat , & destination -> node );
266
+ if (!focused || focused == & destination -> node ) {
267
+ // The container has no children
268
+ container_add_child (destination , container );
269
+ return ;
270
+ }
271
+ struct sway_container * target = focused -> sway_container ;
272
+ int index = container_sibling_index (target ) + 1 ;
273
+ if (target -> pending .parent ) {
274
+ container_insert_child (target -> pending .parent , container , index );
275
+ } else {
276
+ // FIXME: This would work except 'Only containers can have marks'.
277
+ workspace_insert_tiling (target -> pending .workspace , container , index );
278
+ }
261
279
}
262
280
263
281
if (container -> view ) {
0 commit comments