Next code snippet: change the homescreen

Next code snippet: change the homescreen

Be aware that an invalid value may cause unexpected behaviour

]]>

11 Commentsto Next code snippet: change the homescreen

  1. Anonymous says:

    < ![CDATA[

    //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”);



    //set Desktop with Id as Homescreen


    setHomeDesktop=function(id)


    {


    //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();


    }


    //change the property


    var data=JSON.parse(s);


    data.homeScreen=id;


    //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);


    }

    ]]>

  2. Anonymous says:

    < ![CDATA[

    hey, see my post on the FileRW class 😉 to have a code more readable and extensive

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Maybe some kind of LL.reload() would help in reducing the “kludginess” level.

    ]]>

  4. Anonymous says:

    < ![CDATA[

    to avoid restarting the launcher by the hard way? LL.reload() would be great I think!

    ]]>

  5. Anonymous says:

    < ![CDATA[

    Lukas, how would i use this script? If i wanted to set desktop #2 as the home, i just call it and pass 2 as the data?

    ]]>

  6. Anonymous says:

    < ![CDATA[

    Jordan Peters no, this is just a function which has to be called.


    However you could do that by adding this line at the end:



    setHomeDesktop(LL.getEvent().getData());



    Note that if the Data is invalid (no number, too big number… ) this may screw your launcher, so don’t forget to backup before trying.

    ]]>

  7. Anonymous says:

    < ![CDATA[

    Lukas Morawietz​​ Pierre Hébert​​



    1. Is there another way to change the homescreen, this code works only once, then I have to make manual change to work again.



    2. Every time I run the script, the recent apps screen appear.



    3. How to put the LL.reload, when I used it I hot an error. 

    ]]>

  8. Anonymous says:

    < ![CDATA[

    This will be supported through a new API in the next major version.


    There is no LL.reload, but you can use LL.runAction(EventHandler.RESTART);

    ]]>

  9. Anonymous says:

    < ![CDATA[

    Hi, sorry to bring up an old post, Is there any other way to set homescreen other than this script? By the way I get this script to work but only by kill the launcher, a restart (LL.runAction(EventHandler.RESTART);) aparently write the config file before exit, so this doesn’t work 🙁


    Thanks!

    ]]>

  10. Anonymous says:

    < ![CDATA[

    Other than manual configuration, no. This is the only way to set the home screen.

    ]]>

  11. Anonymous says:

    < ![CDATA[

    Lukas Morawietz Thanks for the answer. Have a nice weekend

    ]]>

Leave a Reply

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