I'm on Linux with PIA. I made a list of geographically local regions and my script picks one at random then runs piactl set region $randomregion
On the JD2 settings page, go to Reconnect. Check all 3 boxes. Set reconnect method to External Tool Reconnect. Put the absolute path to your script. If you have PIA I can try and post my little script, formatting on mobile isn't working.