- if (parent and len(parent.nodes) == 1):
- gp = find_parent(i3, parent.id)
- if (gp.nodes[0].id == parent.id):
- if (gp.layout == 'splitv'):
- i3.command('move down')
- else: # splith or tabbed
- i3.command('move right')
- else:
- if (gp.layout == 'splitv'):
- i3.command('move up')
- else:
- i3.command('move left')
+ #
+ # Todo: if the direction we are moving has a split/tabbed container
+ # as a peer to parent, this will move our window into that container
+ # instead of what we want. And in fact, the whole logic below is
+ # incorrect and based on testing which did not realize that fact.
+ #
+ if (parent and parent.type == 'con' and len(parent.nodes) == 1):
+ # https://unix.stackexchange.com/questions/173754/how-to-move-a-window-up-to-the-level-of-its-parent-window-in-i3wm
+ i3.command('mark i3ha')
+ i3.command('focus parent')
+ i3.command('focus parent')
+ i3.command('mark i3hb')
+ i3.command('[con_mark="i3ha"] focus')
+ i3.command('move window to mark i3hb')
+ i3.command('unmark i3ha')
+ i3.command('unmark i3hb')