Triggerable conditional activation groups

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.

Hey!

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

tell t

if URL starts with "https://www.netflix.com/watch" then

set str to "Skip Intro"

end if

end tell

end repeat

end tell

else

return ""

end if

return str

I know its useless but it looks fancy :joy:

1 Like

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!

In v2.700 alpha you can use the new triggers in the Other tab:

"Conditional Activation Group Activated" and "Conditional Activation Group Deactivated". This allows you to trigger stuff when one of your activation groups becomes active / inactive.

1 Like

I think we misread the feature!

He's asking for a new "if applescript is true" condition, @Andreas_Hegenberg?

It'd be very useful for my safari widgets over at AquaTouch...

Ah yes, sorry I wanted to reply to another thread.

Apple Scripts in conditional activation groups won't be possible for performance reasons. However I'm currently adding BTT variables (which can be set via Apple Script) as conditions.

Understandable, I guess the same effect could be achieved using it right?

Yes, it's now possible in v2.702 alpha :slight_smile: