Script for easier area split/join, help needed

Hi!

I’m trying to do my first Simple Operator script. What I want to achieve is faster area split/join’s. I’m on a wacom and the split handler (in the corners) are to pesky to click (99% of the times I move the 3d cursor instead of splitting)

So what I want to achieve is, split the view with a shortcut. and possible join it also by pressing shortcut then move cursor in the direction you want to join.

bpy.ops.screen.area_split()

makes the area split with the default args, of HORIZONTAL and 0.5 , so it splits the current context in half.

but what I can’t figure out is how to get mouse_x and mouse_y positions. so I can compare that with the current context width or height, to get a value between 0.0 and 1.0 to split at.

at

[bpy.types.Events](http://www.blender.org/documentation/250PythonDoc/bpy.types.Event.html?highlight=mouse_x#bpy.types.Event.mouse_x) 

I found the mouse_x and mouse_y events, also mouse_prev_x and mouse_prev_y

that’s awesome! if I could compare mouse_x with mouse_prev_x, I can get direction and use that for area_join()

but I am stuck, anyone that knows blender’s py api for screen interaction could you please help out a bit.

Thanks!