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).
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?
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 Music.app 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 com.apple.Music 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.
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.
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: Music.app":
tell application "BetterTouchTool"
set_string_variable "customVariable1" to "MusicAppRunning"
end tell
Trigger "Specific App Did Terminate: Music.app":
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?
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.
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: