Desktop bookmark modifier tool script
Desktop bookmark modifier tool script
This script allows you to modify desktop bookmarks and ‘go to specified desktop&position’ shortcuts, or even make new ones in an easier way.
If you use the launcher’s ability to create them, you need to be in the desired position while creating it, and if you want to modify a created one with the app/select shortcut, you need to move it first so you can select it.
This script allows you to set the data of the shortcut to a previously saved one. It modify the launcher ‘go to container and position’ shortcut ( Pierre Hébert, you have a curious way of saving the position ;P ), you don’t need this script after setting it, this is just a tool.
(If you want to set multiple shortcuts in one, check my multi-container bookmark)
Instructions:
Get the position:
Once the container is where you want, run the script (by default: long click the background, script, select)
If the container is not the desktop, it will ask. Cancel to select the desktop instead.
Apply the position
Run the script from the desired item (by default: long click the item, script, select)
If the item is not a desktop bookmark shortcut it will ask for confirmation. You can accept to convert it.
Confirm and the shortcut data will be override with the previously saved one.
]]>
< ![CDATA[
var e=LL.getEvent();
var item=e.getItem();
if(item!=null){
var saved=LL.getScriptTag();
if(saved==null){
alert(“No data saved.\nRun this script from a container first.”);
return;
}
saved=JSON.parse(saved);
if(item.getType()!=”Shortcut”){
alert(“This item is not a Shortcut”);
return;
}
if(!isBookmark(item.getIntent())){
if (!confirm(“This shortcut is not a Desktop bookmark. Do you want to continue? (This will override the item’s intent)”))return;
}else{
//if(confirm(“Do you want to save the current data
}
if(!confirm(“Data found:\nContainer Id: “+saved.p+”\nPosition X: “+saved.x+”\nPosition Y: “+saved.y+”\nScale: “+saved.s+”\n\n Do you want to apply it?”))return;
item.setIntent(Intent.parseUri(“#Intent;component=net.pierrox.lightning_launcher_extreme/net.pierrox.lightning_launcher.activities.Dashboard;i.p=”+saved.p+”;f.s=”+saved.s+”;f.x=”+saved.x+”;f.y=”+saved.y+”;end”,0).setAction(null));
Android.makeNewToast(“Applied correctly”,true).show();
}else{
//no item, let’s save
var cont=e.getContainer();
if(cont.getType()!=”Desktop”)if(!confirm(“The container selected is not the desktop, do you want to use it instead? (cancel to use the current desktop)”))cont=LL.getCurrentDesktop();
var data={};
data.p=cont.getId();
data.s=cont.getPositionScale();
data.x=-cont.getPositionX()*data.s;
data.y=-cont.getPositionY()*data.s;
LL.setScriptTag(JSON.stringify(data));
Android.makeNewToast(“Data saved:\nContainer Id: “+data.p+”\nPosition X: “+data.x+”\nPosition Y: “+data.y+”\nScale: “+data.s,false).show();
}
function isBookmark(i){
return i.getComponent().flattenToString()==”net.pierrox.lightning_launcher_extreme/net.pierrox.lightning_launcher.activities.Dashboard” &&
i.hasExtra(‘p’) &&
i.hasExtra(‘s’) &&
i.hasExtra(‘x’) &&
i.hasExtra(‘y’)
}
]]>
< ![CDATA[
Yes, been wanting a script like this. Thx
]]>
< ![CDATA[
Hi TrianguloY. I love what you did with this script, especially how you can save a bookmark on the desktop from within a panel. I do have 1 request if you don’t mind. Is it possible to modify the script so the page transaction can be instant like in the “page fade” script?
]]>
< ![CDATA[
This script only change the settings of the default LL bookmark.
If you want a instant movement, you need a script.
Check my multi desktop bookmark (it is for multiple containers, but 1 is included in ‘multi’ 😛 )
]]>
< ![CDATA[
So it does. Thanks TrianguloY it works like a charm.
]]>