Hi,
Yes, the command does not work since Automagic will interpret the parts within curly braces.
I would assign the command to a string variable first and use single quotes to avoid that the curly braces are interpreted. Single quotes within the command and backslash need to be escaped using a backslash. An action Script could look like this:
Code: Select all
cmd = 'cat /proc/$(pidof $( dumpsys window windows | awk \'/mCurrentFocus/ { sub(/\\/.*/,""); print $3}\' ))/status | awk \'/Uid:/ {print $2}\''
and then use
{cmd} in action
Execute Root Command.
You could also directly use an inline script in the action:
{'cat /proc/$(pidof $( dumpsys window windows | awk \'/mCurrentFocus/ { sub(/\\/.*/,""); print $3}\' ))/status | awk \'/Uid:/ {print $2}\''}
A shortcut on Android can only be used to start an activity so Automagic receives the shortcut with an invisible activity that will be closed immediately again. Automagic thus becomes the topmost task for a short duration when a shortcut trigger is executed. I agree that the outcome of the condition is surprising in this case but a sleep is the recommended workaround for the moment. I'll ignore the shortcut activity in the next version so that the sleep is not required anymore. Thanks for reporting!
Regards,
Martin