User Tools

Site Tools


script_create_desktop

====== About the script ====== * Purpose : This script create a new desktop * Author : F43nd1r * Current Version : 1.0 * Link : https://plus.google.com/115366157037831519359/posts/4iVMvZKcUoc ====== Changelog ====== * Version 1.0 (15/2/2015): initial release in wiki ====== How to use the script ====== * Run from anywhere an dpass the name for the new desktop as data ====== Issues and Hints ====== * The launcher gets restarted in the process //please report all bugs in the g+ community!// ====== Script ====== <sxh javascript;>//import java classes LL.bindClass("java.io.FileReader"); LL.bindClass("java.io.BufferedReader"); LL.bindClass("java.io.FileWriter"); LL.bindClass("java.io.File"); LL.bindClass("java.lang.System"); //create a new Desktop with specified name createDesktop=function(name) { //create the needed structure var file=new File("data/data/net.pierrox.lightning_launcher_extreme/files/config");//this file contains desktop properties var r=new BufferedReader(new FileReader(file)); var s=""; //read the file var l=r.readLine(); while(l!=null) { s+=l; l=r.readLine(); } //edit the properties var data=JSON.parse(s); data.screensNames.push(name); var newId=0; while(data.screensOrder.indexOf(newId)!=-1)newId++; data.screensOrder.push(newId); //write the changed stuff back to the file var w=new FileWriter(file); w.write(JSON.stringify(data)); w.flush(); w.close(); //restart the launcher System.runFinalization(); System.exit(0); } createDesktop(LL.getEvent().getData()); </sxh>

script_create_desktop.txt · Last modified: 2016/06/28 12:28 by f43nd1r