Is it possible to configure a wacom intuos button with
xsetwacom in a way that pressing that button enables/disables the touch function?
You can enable and disable touch with the following command:
xsetwacom --set 'Touch device name' Touch on
To map it to buttons, see this answer. Basically you map the tablet button to a keyboard key and then map that to a command. You can do the first with
xsetwacom and the latter in the Gnome shortcuts settings.
To toggle the state, you can use
--get and check if it is on or off. The following uses a hacky
grep to misuse it as if statement:
(xsetwacom get 'Wacom Intuos Pro M (WL) Finger touch' Touch | grep -q off) && (xsetwacom set 'Wacom Intuos Pro M (WL) Finger touch' Touch on) || (xsetwacom set 'Wacom Intuos Pro M (WL) Finger touch' Touch off)