| 1234567891011121314151617181920212223 | #!/usr/bin/env pythonfrom json import loadsfrom os import popenfrom sys import argvdef ipcQuery(req="command", msg=""):    ans = popen("i3-msg -t " + req + " " +  msg).readlines()[0]    return loads(ans)def ipcCurrentWindowSize():    id = popen("xdotool getwindowfocus").readlines()[0].rstrip()    answer = popen("xwininfo -id "+id+" | grep -E '(Width|Height)'").readlines()    width=int(answer[0].rstrip().split()[1])    height=int(answer[1].rstrip().split()[1])    return (width, height)(width, height) = ipcCurrentWindowSize()if width > height:    ipcQuery(msg="split h")else:    ipcQuery(msg="split v")
 |