How to disable touchpad when mouse is connected and how to rebind mouse buttons?

It’s not exclusively my fault this ambiguity around ydotool configuration. Here is a summary

yay ydotool
sudo chmod +s $(which ydotool) # all users can use it
# ~/.bashrc
#
export YDOTOOL_SOCKET="/tmp/.ydotool_socket"

mkdir -p .config/systemd/user/
kate ~/.config/systemd/user/ydotoold.service

[Unit]
Description=Starts ydotoold service
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=3
ExecStart=/usr/bin/ydotoold --socket-path="/tmp/.ydotool_socket"
ExecReload=/usr/bin/kill -HUP $MAINPID
KillMode=process
TimeoutSec=180

[Install]
WantedBy=default.target

sudo cp /home/a/.config/systemd/user/ydotoold.service /usr/lib/systemd/system/ydotoold.service
#a is my user name

sudo systemctl daemon-reload
sudo systemctl enable ydotoold
sudo systemctl start ydotoold

logout, login ps -ef | grep ydotool should show bg proc
ydotool key 530:1 530:0 # toggles touchpad in wayland