What context should be passed to screen.area_move() to make it work?
Timer threads have little sense of context.

As outlined here

Context is incorrect when calling from a timer

need to pass some context to the timer.  In this case I've passed a copy of the text editor context when hitting the button.  Pretty sure just the screen is required context, or at most the window and screen.



Note found that calling the resize operator with no delta and moving the mouse worked from within a timer, however it is STICKY and a mouse click (or other events) are needed to unstick the mouse from moving the area.  Not sure how to release.  It is actually quite a handy way to resize the panels.. but still not quite right

import time, bpy, functools
from bpy import context

def snooper(c, w, a, x, y, delta, poll_retries=500):
    #bpy.ops.wm.redraw_timer(c, time_limit=0, iterations=10)

    while not bpy.ops.screen.area_move.poll(c, 'INVOKE_REGION_WIN'):
        poll_retries -= 1
        if not poll_retries:
            return None # out of retries

    # should poll now
    bpy.ops.screen.area_move(c,'INVOKE_REGION_WIN', x=x, y=y)

    y += delta
    w.cursor_warp(x, y)
    return None


if __name__ == '__main__':

    context = bpy.context
    a = context.area
    w = context.window
    x = a.x + (a.width &gt;&gt; 1)
    y = a.y + a.height     

    w.cursor_warp(x, y)
    bpy.app.timers.register(functools.partial(snooper, context.copy(), w, a, x, y, delta=100), first_interval=0.2)


Scissor sets



Looked into the screen areas a while back re overriding context.  Recommend matching areas by the midpoints of edges and if both edge lengths also match they can be "pseudo joined"  into a new area until we have one full window area with instructions on how to split back.  Not unlike a binary tree.

Doing something similar here would be the go, giving the option of 1 to 4 possible resizes..  by looking for any "pseudo joined" areas in tree that have context.area and another area from the screen areas collection.