If you are looking to configure this yourself using standard macro software (like AutoHotKey or dedicated gaming mouse software), here is the logic used: