Thanks for your response, Michael!
I wrote the following very simple script (pardon my language, it's my first attempt at python):
import i3
import sys
targetwidth = float(sys.argv[1])
# get currently focused window
current = i3.filter(nodes=[], focused=True)
currentsize = current[0]['percent'] * 100;
d = int(targetwidth - currentsize)
if d>0:
i3.resize("grow width" + str(d) + " px or " + str(d) + " ppt");
else:
i3.resize("shrink width" + str(-d) + " px or " + str(-d) + " ppt");
While this works nicely, I'm confused by the px and ppt syntax. The manual states the following:
resize <grow|shrink> <direction> [<px> px] [or <ppt> ppt]
... The optional pixel argument specifies by how many pixels a floating container should be grown or shrunk (the default is 10 pixels). The ppt argument means percentage points and specifies by how many percentage points a tiling container should be grown or shrunk (the default is 10 percentage points).
The way I understand this, is that for a tiling container, the px argument will be ignored and vice versa. This however does not seem to be the case.
i3-msg resize grow width 5 px
Grows my tiling window by what appears to be 5%.
i3-msg resize grow width 5 ppt
Does not have any effect
While if I use
i3-msg resize grow width <anynumber> px 5 ppt
anynumer seems to be ignored.
Perhaps this could be clarified in the user manual?