I often use my PS5 controller on my Mac Studio with PS Remote Play to quickly login and check something or pick up a time-bound item without having to leave my work desk. This is great until you press the PS button and it opens the app switch menu, losing focus on the PS remote play window. To disable the PlayStation controller button default behaviour on MacOS, run the following command in the terminal:
defaults write com.apple.GameController bluetoothPrefsMenuLongPressAction -integer 0
If you want to revert this for some reason, you can set the value to 1
instead.
defaults write com.apple.GameController bluetoothPrefsMenuLongPressAction -integer 1
Based on the name I'm assuming this works with (and is designed for) to Xbox controller since you usually long press that button to trigger menus.
From my searching, this used ot be available in the System Preferences, but it seems to have been removed in recent versions of MacOS. The above was last verified to work for me on MacOS Sonoma 14.3.
I hope this saves someone some pain.