How to detect app switching?

I want to do some actions every time the frontmost app changes.

Can I do it with a CAG? Any other options?

Thanks in advance!

Unfortunately I can't find a "when front app changes" trigger. But there is one "when specific app is activated". So if you need this only for a limited number of apps, you can set it up individually. Maybe you can do it with a script, but I don't know anything about that.

My goal is to detect any app switching, not specific apps.

I know this was just a suggestion.... :slightly_smiling_face:

Maybe Andreas is willing to add the trigger "when front app changes". This should not be very complicated, since BTT surely already registers this now.

1 Like

Yes, a trigger "when front app changes" would be great! :grinning:


Maybe the trigger "Distributed Notification Name" could be useful for getting when the front app is switching?

i’ll add a dedicated trigger for this!

Thank you Andreas!!!!
:heart: :heart: :heart::heart: :heart: :heart:

Thinking of this new trigger, some ideas:

What about adding two triggers that differentiate the "new" app that goes to frontmost and the "old" app that has leaved it?

Something like "every time an app is activated" and "every time an app is deactivated"

It could be useful to apply changes/actions to the frontmost app or to the previous frontmost app.

Another idea is to add also these 2 triggers in the conditions of CAG and in the conditions of the Advanced conditions.