> Is it possible to set the current foreground app to a variable? I saw a few comments like this one that suggest that we might not be able to do this yet.
>
Most foreground apps will have a window value... check out the user guide / variables / window value. %WIN. You need tasker selected in your android accessibility settings for it to work...
Kill Current App (8)A1: Run Shell [ Command:dumpsys window windows | grep -E 'mCurrentFocus' Timeout (Seconds):0 Use Root:On Store Output In:%rawdump Store Errors In: Store Result In: ]A2: Variable Search Replace [ Variable:%rawdump Search:\S+\. Ignore Case:Off Multi-Line:Off One Match Only:Off Store Matches In:%rawdump Replace Matches:On Replace With: ]A3: Variable Split [ Name:%rawdump1 Splitter:/ Delete Base:Off ]A4: Variable Set [ Name:%CURRENTAPP To:%rawdump11 Do Maths:Off Append:Off ]A5: Run Shell [ Command:am force-stop %CURRENTAPP Timeout (Seconds):0 Use Root:On Store Output In: Store Errors In: Store Result In: ]A6: Flash [ Text:%CURRENTAPP Killed Long:Off ]A7: Stop [ With Error:Off Task: ]
>
> If buttons can't be used I guess a gesture could be the trigger.
I'm guessing a notification click would not suit your needs?
>
> A notification click would unfortunately not always work, because some apps hide the taskbar, but thank you I hadn't thought of that.
DOH.... That was a bad suggestion anyway, I had forgotten the window value changes When the notification is pulled down.. :(
Does anyone have other ideas for a trigger?
This might work..
If you have a context monitor for the recent apps window ( it is Recent on my device) and show a small scene button when the recent apps list is displayed. If the button is pressed then with the next window change ( which would be the app you want to kill selected from the recent apps) kill that app..
So you would
1. long press home to get recent apps list.
2. Hit button from scene
3. Select app you want to kill
4. Tasker kills app
> I am starting to like the thought of shaking my phone like a madman any time an app needs to die,
I believe a context constantly monitoring for shake might be hard on the battery...
Unfortunately it looks like either the transparent GS3 recent apps list does not count as a window,
Well that is unfortunate, I assume you have seen other window values and have selected tasker in your android accessibility settings?
This is a profile I use to help figure the %WIN values
Profile: Win Changed (375)
Event: Variable Set [ Variable:%WIN Value:* ]
Enter: Anon (376)
A1: Flash [ Text:%WIN Long:Off ]
A2: Variable Set [ Name:%Awin To:%WIN, Do Maths:Off Append:On ]
That way you can check the %Awin in the variables to get exact spelling.
Actually, that is how I switch from full intensity (shake quickly in/out), to low intensity (shake quickly side to side) and monitoring for that hardly affects the battery on my device. Just FYI, if you wanted to try it :-)
> I'm still trying to avoid using gestures altogether, though.
Starting to run low on ideas ... I Have not been able to find a way to get the last app info or recent app info. It might be in the dumpsys but I could not locate it. Without that ability I would think you might have to keep your own recent app list with a context that records the windows value on every change and then from your home screen you could have a task cut that opens a menu scene with a list of recent apps that you could select one to kill.
Probably not what you are looking for..... :(