Yes, I've just recently learned the meaning of ampersand symbol. The interpreter doesn't wait for the command to finish execution, but instead continues to the next section of code, something like that.
What appears to be the problem here is the script executing too soon, before the Kindle is able to render kindlemenupage.html, the task set by this code:
Code:
(usleep 250000; lipc-set-prop com.lab126.pillow customDialog '{"name": "../../../../mnt/us/extensions/kindlemenu/bin/kindlemenupage", "clientParams": {"dismiss": true}}') &
It appears the above job is delayed by 250 milliseconds!
So what happens if we delay the job responsible for starting clean_launchers.sh?
Code:
(usleep 300000; /mnt/us/extensions/kindlemenu/bin/sh/clean_launchers.sh ) &
The above code appears to execute the script right on time, I tried 250ms but it didn't work out after a cold boot - the script was firing up too soon again!
I would like to hear if there's a better way to achieve the same result, because this doesn't seem too robust (relying on the performance of the Kindle when timing background jobs). Does calling cleanup_launchers.sh via javascript once the DOM elements have loaded sound like a good idea?