I have a script that centers a currently active window to the total width and height of all your screens (so basically puts the window half way on first and second monitor). I don't know xdotools (the script is from the internet, and works) and hence I'm asking here for help to make it center to either the primary monitor or to currently active monitor.
Here's the script:
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]*//')
xdotool getactivewindow windowmove "$newPosX" "$newPosY"
That would be true if I had two the same monitors, then I'd just play with the math and be done with it, but I have one 1920x1080 and one 1600x900 monitor, and I'd want it to read the current monitor I'm in, which I don't know how to do. But alright, guess I will not get help here.