How add and use this action?

General discussions about Automagic and automation in general

Moderator: Martin

Post Reply
sirlaacher
Posts: 4
Joined: 17 Mar 2019 02:57

How add and use this action?

Post by sirlaacher » 04 Oct 2019 14:27

Hi. Just fast question. In exposed i was use action: When i press one from hardware button i can check what activity is on first plan . And really miss that :D. How can i find this in Automagic?

User avatar
Martin
Posts: 4408
Joined: 09 Nov 2012 14:23

Re: How add and use this action?

Post by Martin » 04 Oct 2019 18:38

Hi,

You can use trigger Activity Started to detect activities. You can add an action Notification on Screen: {package_name}/{activity_class} to show the component name.

Regards,
Martin

User avatar
Desmanto
Posts: 2144
Joined: 21 Jul 2017 17:50

Re: How add and use this action?

Post by Desmanto » 04 Oct 2019 19:21

Alternative method, since you have root, you can use dumpsys command. Martin's solution works. But in case you don't want it to be triggered everytime you open other app and only want it to be trigger manually, dumpsys method will be more suitable. Use trigger Hardware Key event and choose your key. Then add execute root command

Code: Select all

dumpsys window windows | grep -E 'mCurrentFocus'
Then use regex in script to get the package name, app name and the activity.

Code: Select all

find = findAll(stdout, ' mCurrentFocus=Window\\{.* u\\d (.*)/(.*)\\}', true);
pn = find[0][1]; //package name
act = find[0][2];  //activity class
app = getAppName(pn); //app name
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190829, Pie 9.0, Rooted.

Post Reply