Switcher instead of a button

Hello, is there a possibility to use a switch button, which would switch between on/off? For example, let's assume I want a button, which would hide my bookmark panel and show it when I press the same button next time.

Can you help?

thx

You can make this work with and Apple script Widget and alternative icons. Keep in minds that you can't "drag" this switch, only press it.

This Applescript seems to do the trick on it’s own: https://apple.stackexchange.com/questions/219730/applescript-toggle-to-do-this-this-time-and-that-next-time

But I’m still figuring out how do use this as a "Run Applescipt and show return Value" BTT Touch Bar widget...

Here is an example how to use one button to trigger two different actions using apple script, variables and named triggers

Thanks!

another example, there are two buttons "up" and "down" icons which visibility is changed on tap
UUID of a button you can get by clicking right button on trigger.
this is example of switcher for do not disturb mode (BTTPredefinedActionType=200)

tell application "BetterTouchTool"
set muteState to get_number_variable "SystemDoNotDisturbState"
if muteState is 0 then
update_trigger "9607A61B-39CB-4F01-A641-045BC03619D8" json "{"BTTEnabled2" : 1}"
update_trigger "5D48E3D1-F31C-4D59-AABD-72BC705FE1E3" json "{"BTTEnabled2" : 0}"
else
update_trigger "9607A61B-39CB-4F01-A641-045BC03619D8" json "{"BTTEnabled2" : 0}"
update_trigger "5D48E3D1-F31C-4D59-AABD-72BC705FE1E3" json "{"BTTEnabled2" : 1}"
end if
trigger_action "{"BTTPredefinedActionType" : 200}"
end tell