I've got a workflow where when I plug in to my external monitor, I want a "sleep display" button to show up. Currently I've achieved this using a widget that changes its icon from blank to the sleep icon when it detects 2+ displays, but when I'm unplugged that widget sometimes covers up buttons in the scrollable main container. I'd love to see a parameter in the conditional activation group pane that runs applescript like the widgets do and activates when it returns true.
As a workarround while they implement the feature, in "select touch bar widget/gesture" select run applescript
In the script at the top write "set str to "" as string" then creat an if 2+ monitors are plugged in then set str to "Sleep Display" and at the end of the script write "return str.
This will set the value of str as a name for the button, and if the button does not have a name, it is not displayed, therefor if str is "Sleep Display" (when there are 2+ displays plugged in) the button will show up, else it won't
Here is an example with a script I wrote for a "Skip Intro" button for Netflix
set str to "" as string
if ((str is equal to str) and ( application "Safari" is running)) then
tell application "Safari"
repeat with t in tabs of windows
if URL starts with "https://www.netflix.com/watch" then
set str to "Skip Intro"
I know its useless but it looks fancy
basically if you
return "" (nothing as text), the entire widget will hide entirley. it will go invisible.
If you return some text again it'll pop up again for you!
Let's delete the clutter here! gotta keep things neat.