View Single Post
Old 01-23-2013, 02:36 AM   #111
stepk
Groupie
stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.stepk ought to be getting tired of karma fortunes by now.
 
Posts: 164
Karma: 593450
Join Date: Oct 2012
Device: K5 B011 5.3.2.1
improved sh?

Quote:
Originally Posted by eureka View Post
I've found a way to run KindleLauncher with swipe over Menu button. Tested on Kindle Touch 5.3.2.
This is exciting! I don't have my KT with me right now so I can't test it, will do. Meanwhile I noticed how to speed it up (on my Windows PC by a factor of about 20) by eliminating the sh line that squeezes $SCRIPT. Note that I reversed the role of single and double quotes! Please try this script (untested on KT, tested on Windows busybox)
Spoiler:
Code:
#!/bin/sh - 

set -o nounset # Treat unset variables as an error
set -f # No filename expansion

# note: misprints lines that start with '-n'
SCRIPT=$(while read line; do echo -n ${line//$'\"'/$'\"'}; done << 'JAVASCRIPT'
(function () {
  var launcherPath = "/mnt/us/documents/KindleLauncher-2.0.azw2";

  var menuButton = document.getElementById("menu");
  var swiped = false;
  var launcherApp = "file://" + launcherPath;

  menuButton.addEventListener("mousedown", function () {
    swiped = true;
  });
  menuButton.addEventListener("mouseup", function () {
    swiped = false;
  });

  document.body.addEventListener("mouseout", function () {
    if (swiped) {
      swiped = false;
      nativeBridge.setLipcProperty(
        "com.lab126.appmgrd",
        "start",
        launcherApp
      );
    }
  });
})();
JAVASCRIPT
exit
)

MESSAGE='{
  "__id__":   "0",
  "pillowId": "search_bar",
  "replySrc": "",
  "function": "'${SCRIPT}'"
}'

lipc-set-prop -s com.lab126.pillow interrogatePillow "$MESSAGE"

Last edited by stepk; 01-23-2013 at 06:37 AM. Reason: changed script to preserve double-quoting style
stepk is offline   Reply With Quote