How to create multi-mode homescreen shortcuts with Tasker

Home 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:

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!

Share this:

About the Author

Andreas Ødegård was an associate editor at Pocketables. He’s more interested in aftermarket (and user created) software and hardware than chasing the latest gadgets and tends to stick with his choice of device for a long time as a result of that. Currently that includes an iPad mini and a Samsung Galaxy S II.

Mike

I see a lot of room for (user)error and one needs to actually count the taps, imho not ideal. Besides, it takes times, ms stacking up.

What about (stacking) scenes?

Works basically the same, but you could overlay an icon indicating status and what would come up if launched/not tapped again.

I’m not sure what’s the task you’re trying to solve here, but I’m sure it can be made better also binding it to one of your profiles(home, …).

Andreas Ødegård

I think the dual mode version has most potential in that it’s fairly easy to deal with single and double taps. The advantage of this over scenes or widgets is that it uses shortcuts that adhere to the same rules as every other shortcut on the desktop. It’s not the same as dynamic shortcut based on profiles though, because this isn’t meant to do different things based on different situations but rather different things at any given point in time

Mike

> adhere to the same rules as every other shortcut on the desktop

What do you mean by that?

And just to make sure you get me right, I was talking of using a Tasker shortcut to launch a scene.

Andreas Ødegård

You can in theory create widgets and scenes that mimic icons on the home screen, but then you have to intentionally go out to make sure they look like they should. Normal shortcuts however have icon sizes and label settings that apply to all, so it’s easy to make them match. Also uses no memory

Not sure what you mean by stacking scenes in this context

Mike

What I meant is,

1. create shortcut->tasker->task (give name, icon)
2. this task launches a scene, overlaying the shortcut’s icon with another icon, symbolizing what would be action 2, tapping that would change icon and task for action 3 and so on

That way, you could actually see what would be next and wouldn’t need to keep track of the number of taps.
Additionally, you could create a cancel area around it, just like you did with your sidebar, to set the counter down if you mis-tapped.

Make the cancel area transparent and you’ve got the illusion of a changing shortcut icon.

Andreas Ødegård

Yeah that’s what I figured you meant, and it has its uses, but I think it’s also a bit complicated for basic dual mode functionality. Also much slower since you need to wait for the scene, so you might as well use a folder

Hussain

The dual mode can be done without Tasker.

I use Nova Launcher Prime (but Apex users should have this as well).

Long tap on an icon on your homescreen
Select ‘Edit’
Select a ‘Swipe Action’ > An app, a shortcut, whatever you like!

Andreas Ødegård

Nothing like that in apex, need to check out nova

Hussain

It may be a paid feature.

Andreas Ødegård

I have the paid version of apex. Tried nova, but it lacks some essential (to me) settings so I hit the refund button.

@Hussain
I couldn’t get the dual mode shortcut to work reliably in Tasker, but thanks to your tip, I got the same thing done in Nova.

With the case on the phone, it’s hard to press the power button to turn the screen off. So I made two actions in tasker:
1: “Screen Off Fake”, an action that flashes the text “Swipe to lock” on the screen.
2: “Screen Off”, an action that applies the system lock.

Long press on a Nova home screen, select action, tasker, and then “Screen Off Fake”.
Long press “Screen Off Fake”, edit, select swipe action, select “Screen Off”.

Now, pressing the icon once (say, accidentally) reminds you to swipe.
Swipe, and the “Screen Off” locks the system.