Conditional activation group, condition matches too much

I have a conditional activation group that has one condition: "List of running processes contains Music".

My intention is to have this match only the MacOS Music application, but it seems to match any process that has the word "Music" in it, such as "Music Creation".

How do I adjust the conditions to make it match only the Music app (only when the process is running, obviously).


Use bundle id in the condition instead and As the text.

1 Like

[EDIT: there's a problem, see next message.]

Awesome, thanks.

Actually, that doesn't quite do it. It seems that the bundle identifier condition is met only when the Music app is active, not when it's merely running. Is there a way to set the conditions so that they match the Music app, whether it's at the front or in the background?

That should work regardless of whether the app is in front or not. Can you post a screenshot of your conditions?

Here's the screenshot. The setup is super simple. Also, for the record, I'm using BTT 3.389 (1612). Just to be clear: with the following condition, the buttons in the conditional activation group immediately appear when the Music app is at the front, and immediately disappear otherwise.

My bad. Actually, it will only match when the app is in front. So you are getting the results as expected.

About your problem: So you want a set of button to show up only when running (whether in foreground or not, whether playing or not), is that correct?

Solution: What I'd do in that situation is use one of the custom variables in the CAG to check whether the particular app is running or not. The variable can be set and reset using scripts which need to be triggered from the Named & Other Triggers- there's a trigger called Specific App did launch and Specific App did Terminate respectively.

[EDIT: there's a problem, see next message.]

Thanks, that seems to work! However, it does strike me as a bit of a workaround for a relatively simple problem. No? Maybe adding an option for exact matches or regex matches for the "List of Running Processes" condition might be better?

With the current solution (below), one problem might be that the custom variable might, in some cases, "lose sync" with the list of running processes. I'm not sure, though.

Nevertheless, here is what I did to get it to work, following the above suggestion.

First, the conditional activation group:

Then in "Named & Other Triggers" ("All Apps"), I added two triggers with "Run AppleScript (async in background)" actions, as follows.

Trigger "Specific App Did Launch:":

tell application "BetterTouchTool"
	set_string_variable "customVariable1" to "MusicAppRunning"
end tell

Trigger "Specific App Did Terminate:":

tell application "BetterTouchTool"
	set_string_variable "customVariable1" to "MusicAppNotRunning"
end tell

I used non-persistent variables. I guess I could have used persistent variables with "set_persistent_string_variable" instead of "set_string_variable", but I don't think it would have changed much.

Nope, still doesn't work properly. After waking from sleep, the conditional activation group buttons are no longer there, even though the Music app is still running. Any other ideas?

If you add a comma before and after the name it should work. E.g. ",Music,"

1 Like

Haha! That's a gem. How did we not think of using the separator in your list of processes, of course, there would have been some separator. This might come in handy some day.

Clever, thanks!

hi. am i understanding how this works?

identify browser apps (testing both bundle and app name):

if true, these would / should(?) work (i see the gestures but actions don't work):

i have confirmed that when i created a separate / individual browser set, these gestures do work.


just checking in and curious if this ping would bring topic into "new" category for review...

also, what's usually the response time on this forum?

The initial question was about getting a button group to show if a certain app is running in the foreground or the background (i.e., conditional activation groups). If this reply doesn't answer your question, then you should probably start a new post in the forum. So if conditional activation regardless of foreground/background state is really what you're after, then you can just put the app name between commas, as follows:

If that doesn't help, start a new topic.

it does not answer my question, but thx. i will start a new thread...