double click to launch

double click to launch

This is a small script I made in the alpha. I thought I had updated it…it seems I forgot 😛

But now I updated it to allow custom tap/doble tap!

Instructions:

Set the script in an event of the items you want. You may want to set it in the tap action, but nobody says you can’t set it in a swipe or something else. By default it will launch the item when single tap, and go to the main desktop when double tap. But of course you can (and may) change them to what you want, you will need to know scripting to do so.

With widgets it works ok, but the widget always get executed when tap, and perform the launch action will send a error. You can use this for example to do nothing when tap, and something when double tap (even thought the widget will get both clicks! )

———————————-

//time in milliseconds between clicks

var delta = 250;

function singletap(){

//action to execute in single tap

item.launch();

}

function doubletap(){

//action to execute in double tap

LL.goToDesktop(LL.getHomeDesktop().getId());

}

var event=LL.getEvent();

var item=event.getItem();

var id=item.getId();

var time=event.getDate();

var data = JSON.parse(LL.getScriptTag())||[-1,-1];

if(data[0]==id && time < ( data[1] + delta) ){

LL.setScriptTag(null);

doubletap();

}else{

LL.setScriptTag(JSON.stringify([id,time]));

setTimeout(function(){data2=JSON.parse(LL.getScriptTag())||[-1,-1];if(data2[0]==id&&data2[1]==time)singletap();},delta);

}

]]>

2 Commentsto double click to launch

  1. Anonymous says:

    < ![CDATA[

    Nice one!

    ]]>

  2. Anonymous says:

    < ![CDATA[

    It should be easy to create 3 (or more) tap actions with this idea. Nicely done.

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *