AndroidAppsGood and EVO

How to create multi-mode homescreen shortcuts with Tasker

Screenshot 2013 05 01 19 17 58 - for some reason we don't have an alt tag hereHome screen shortcuts have several advantages over widgets, but they also have several disadvantages, and one of them is that they’re very static. Shortcuts normally do one thing, and only one thing. That’s what makes it unique when launchers like Action Launcher Pro comes along and uses shortcuts in new ways, but unfortunately it comes at the cost of other features.

After uninstalling Action Launcher Pro because of its lack of features, I started thinking that perhaps I could replicate the things that made it interesting in the first place. I started thinking about ways of giving home screen shortcuts the ability to have more than one feature, and I think what I came up with has potential for a lot of things.

Basically the concept here is to create a task that is capable of counting how may times you tap the shortcut that launches it, and base what it does on that. There are several ways of doing this, but these are the two best I’ve found so far.

Dual mode shortcut

  • If [ %Dttest ~ 0 ]
    • Variable Set [ Name:%Dttest To: 1]
    • Wait [ MS:300]
    • Variable Set [ Name:%Dttest To: 0]
    • Flash [ Text:Action 1]
  • Else
    • Flash [ Text:Action 2]
    • Variable Set [ Name:%Dttest To: 0]
  • End If

Abort Existing Task checked in task settings

This is then added to the home screen as a Task Shortcut, and works as follows:

The task shares basic similarities with a toggleable task. It runs one of two sets of actions, depending on the value of a variable, here %Dttest (“Double tap test”- my naming logic). Both action groups end with setting that variable to , which means that it will always be 0 when the task first launches, thus running the first action group. This action group flips the variable over, waits 300 milliseconds, then sets it back and does a Flash action, which is here a stand-in for anything you want a single tap on the shortcut to do (could e.g. be to launch an app).

However, the task is set with collision handling to Abort Existing Task. This means that if the task is run while already running, it will stop running the first instance of it, giving the second priority. This is not the default setting, which is to abort the new one instead. By using this setting (accessed from the settings icon in the task’s action list), tapping the icon a second time right after the first (within 300ms- the Wait action) will actually abort the first task before it has a time to run the Varible Set for flipping %Dttest back to 0. The trick here is to tap at a speed that makes it abort the task after %Dttest is set to 1, but before it’s set back to 0, meaning in the Wait period.

Since %Dttest will then be 1 when the new task runs, because the first task wasn’t able to finish, it will run the second set of actions, found in the Else group. The result is that single tapping runs what’s listed under If, and double tapping runs what’s listed under Else.

Here’s how this looks in practice:

 

Multi-mode shortcut

This example above shows a dual mode shortcut, but it’s possible to make it have more modes. To do that, you create a task that looks like this:

Variable Add [ Name:%Dttest Value:1] Wait [ MS:300] Flash [ Text:Action 1] If [ %Dttest ~ 1 ] Flash [ Text:Action 2] If [ %Dttest ~ 2 ] Flash [ Text:Action 3 If [ %Dttest ~ 3 ] Variable Set [ Name:%Dttest To: 0 ]

Abort Existing Task checked in task settings

It works on the same basic principle, but it counts actual number of times the shortcut is clicked, rather than working on a once/not once principle. The advantage is that it’s perhaps easier to understand, and it’s more dynamic with number of modes. The downside is that it won’t simply revert to the last option available if you tap too many times. By that I mean that if you triple tap on the first example, the one that uses If/Else, it will trigger the second action group, meaning it’s more forgiving for tapping too much. That might not be enough of an advantage to warrant the first method ever being used, but I thought I would include it since I’m just experimenting with different methods here and there might very well be another way that’s much better than this altogether.

Important to note about both methods

Both methods might fail for various reasons. I’ve tested this in Apex launcher, and as you can see it works, but I don’t know if every launcher out there conveys shortcut presses quickly enough to allow for this to work, or if they convey multiple taps at all.

The timing for the Wait action is also dependent on various factors, such as how fast your device is, how fast you plan on tapping, etc. You basically just need to experiment.

What this can be used for

I originally made this based on the Shutters feature in Action Launcher Pro, and plan on posting more specific details to replicating that functionality in a separate post. This has a lot of uses though, and allows you to stuff more into a shortcut without using folders. You can for instance have an icon that launches the phone app, contacts app, or messages app depending on how many times you tap it, or an email icon that launches private or work email clients depending on the number of taps. This could also be used as a security feature, launching a dummy email client with no sensitive accounts if tapped normally, but launching the proper one if tapped twice (should be combined with hiding the app from the launcher).

You could also be more creative, like having a double tap on Dropsync trigger a “sync now” shortcut, just to name one app that I have which has a very specific shortcut action available. The camera icon could have a double tap feature to go to video directly, a Facebook icon could have Facebook Messenger as the second option, and so on. Lots of possibilities!

tasker banner - for some reason we don't have an alt tag here

Pocketables does not accept targeted advertising, phony guest posts, paid reviews, etc. Help us keep this way with support on Patreon!
Become a patron at Patreon!

Andreas Ødegård

Andreas Ødegård is more interested in aftermarket (and user created) software and hardware than chasing the latest gadgets. His day job as a teacher keeps him interested in education tech and takes up most of his time.

Avatar of Andreas Ødegård