Is there a simple way to minimise an app from a button?

I can see a way to minimise the app under the cursor but I just want to minimise the app that the button is linked to. Is this possible?

isn't that the same? (wouldn't the mouse always be over the button if you trigger it ?)

Not really. The button is on the touch bar! Sometimes you move the mouse out of the way or just move it somewhere else without clicking but the focus stays on the app you want to minimise. If you then click the minimise button, it does nothing as the mouse is not on the app window.
Wouldn't it be better to just have a "minimise" function?
Just a thought, probably a stupid one!

I'm not sure I understand, but couldn't you just trigger the cmd+m shortcut then via that Touch Bar button?

Haha, you're absolutely right!
I'm new to Mac OS so my knowledge of shortcuts is pretty poor and I didn't know this one! I'll add that shortcut to a button and that'll work.