Return to root by pressing a button

I’m making a DIY Streamdeck with OSC and I’d like to have the option to return to the root either from inside a modal or from another tab with a button (maybe using a script). I’m going to use a touchscreen Raspberry Pi so I won’t have the ESC key and the little x button in the modals is really small on a 7inch display. The modals are set to 100% x 100% (fullscreen). Maybe there are better ways to implement this?

Update: After some searching in the forum and adapting legacy examples I’ve managed to make this work.