Closed mxmilkiib closed 5 years ago
I think center=on
is for setting the position of pseudo-tiled windows within their node. If you want to reposition a floating window you may need to use another tool, such as xdo, wmctrl or xdotool.
I've tried
bspc rule -a \* --one-shot node=focused center=on
but it doesn't work.
You also need state=floating
(node=focused
is unnecessary).
I think
center=on
is for setting the position of pseudo-tiled windows within their node.
No it isn't. There's a global setting for this, called center_pseudo_tiled
(cf. man bspc
).
I realise now that no form of --one-shot rule is going to be a solution to this problem as they only affect windows spawned after rather than existing windows (or am I incorrect in that assumption?).
I ended up going with this kludge found via a search;
IFS='x' read screenWidth screenHeight < <(xdpyinfo | grep dimensions | grep -o '[0-9x]*' | head -n1)
width=$(xdotool getactivewindow getwindowgeometry --shell | head -4 | tail -1 | sed 's/[^0-9]*//')
height=$(xdotool getactivewindow getwindowgeometry --shell | head -5 | tail -1 | sed 's/[^0-9]*//')
newPosX=$((screenWidth/2-width/2-4))
newPosY=$((screenHeight/2-height/2-3))
xdotool getactivewindow windowmove "$newPosX" "$newPosY"
N.b. the -4
and -3
in the newPos calculations are added as otherwise the window does not align with a floating window of the same standard size created using a one-shot rule. Also, there is no guarantee of an exacting centre position with windows of varied size.
I realise now that no form of --one-shot rule is going to be a solution to this problem as they only affect windows spawned after rather than existing windows (or am I incorrect in that assumption?).
This is correct: the rules don't affect existing windows.
I've tried
bspc rule -a \* --one-shot node=focused center=on
but it doesn't work. Is there a correct way to achieve this?