How can I make my touch bar change to a list of my opened apps

I'm trying to accomplish CMD + NUMBER tab switching like feature

Do you know how to make a Touch Bar widget ? These can display the output of an AppleScript, which can retrieve a list of open applications.

How this is scripted depends very much on which apps you want included: only visible windowed apps ? Only apps present on the dock ? Whether to include or exclude menu bar apps ? And whether to include or exclude background-only apps ?

If you have an idea, let me know, and I can help with the scripting part.