You can automate this using BTTBetterTouchTool - automations (https://folivora.ai/):
note: Don't be afraid to pay 20$$20 for the whole tool, it will pay for itself in no time. The tool is must have for anyone working seriously on macos in my opinion as it adds so many features missing in standard macos.