How can I disable the touchscreen when closing the lid?

My GPD Win MAX 2 (2024) unfortunately registers phantom touch events when closed and used via a dock. I can disable the touchscreen via command line (with sudo bash -c 'echo "0018:27C6:0113.0004" > /sys/bus/hid/drivers/hid-multitouch/unbind').

Now I would like to tie this to opening / closing the lid. How can I run this command (and the corresponding bind-version) when the lid is triggered?
Was this page helpful?