is there a way to create a slider that will lock and unlock touchbar I keep hitting touchbar buttons on accident

in trying to create a swipe touchbar feature that will lock or display a blank touchar so i dont touch touch bar buttons on accident and when I want to use touchbar buttonsI can swipe and then then it will reveal my touchbar buttons.