07-21-2012, 10:04 AM | #1 |
Groupie
Posts: 164
Karma: 164969
Join Date: Dec 2011
Device: Palm IIIx, (iPhone|Kindle) Touch
|
How to make the store button useful?
I have absolutely no need for the store button on the standard KT interface. I don't shop in the Amazon store and I haven't even registered my KT.
So how can I repurpose the store button? A simple first step is to replace the store button image with one that is less ugly. Copy the attached image to your kindle and type this: Code:
mntroot rw; cp space_invader.png /usr/share/webkit-1.0/pillow/assets/search_bar/store.png ; mntroot ro But that doesn't change its function yet. Does anybody know how to do this? I'm currently still on 5.0.4 so I guess using nativeBridge.dbgCmd would have been an option but as we all know this will disappear with 5.1.1. As far as I have come I think we have to inject an application into the lipc event system on the KT. If you have a html/js application on the KT that's probably easy as you can use wafapp to load that app. But there is no possibility to call a Java or native app from that web application? Does anybody know how to do a lipc conforming Java or native app? Last edited by bhaak; 12-09-2012 at 12:35 PM. Reason: added the inverted png |
07-21-2012, 10:28 AM | #3 | ||||
(offline)
Posts: 2,907
Karma: 6736092
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
|
Quote:
Quote:
Quote:
Quote:
Code:
INSERT INTO "properties" VALUES('com.lab126.draw','command','/usr/bin/wafapp -l com.lab126.draw -c /var/local/waf/draw/'); Code:
INSERT INTO "properties" VALUES('com.lab126.booklet.home','lipcId','com.lab126.booklet.home'); INSERT INTO "properties" VALUES('com.lab126.booklet.home','jar','/opt/amazon/ebook/booklet/home.jar'); INSERT INTO "properties" VALUES('com.lab126.booklet.home','supportedOrientation','U'); INSERT INTO "properties" VALUES('com.lab126.booklet.home','maxLoadTime','40'); INSERT INTO "properties" VALUES('com.lab126.booklet.home','maxGoTime','30'); INSERT INTO "properties" VALUES('com.lab126.booklet.home','defaultContext','context=0'); |
||||
07-21-2012, 10:48 AM | #4 |
(offline)
Posts: 2,907
Karma: 6736092
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
|
Some more:
Maybe the easiest Booklet to dissect would be the com.lab126.booklet.test, because it's pretty small (the entire jar is only 33kB, and it only contains a dozen or so classes (including inner classes)). It can be started using lipc-set-prop com.lab126.appmgrd start app://com.lab126.booklet.test I haven't figured out how to "operate" it, probably by interacting with it through lipc itself: Code:
[root@kindle root]# (lipc-probe -a -v|grep -A 7 '^com.lab126.booklet.test') 2>/dev/null com.lab126.booklet.test w Str runtest w Str pause w Str unload w Str stoptest w Str load w Str go w Str startresult Spoiler:
HTH |
07-21-2012, 01:10 PM | #5 | ||
Groupie
Posts: 164
Karma: 164969
Join Date: Dec 2011
Device: Palm IIIx, (iPhone|Kindle) Touch
|
Quote:
Code:
/* Commenting out to test no XOR look feel .store:enabled:active { background-image: url('../assets/search_bar/store_active.png'); }*/ Quote:
Code:
120721:190343 appmgrd[963]: W appmgr_history:timeout_check:lipc_id=com.lab126.store,state=EXECUTED:Timed out waiting for app to register a lipc id Thanks for the tip about com.lab126.booklet.test. I'll have a look at its decompiled source and try to use it. |
||
09-21-2012, 03:06 PM | #6 |
Groupie
Posts: 164
Karma: 164969
Join Date: Dec 2011
Device: Palm IIIx, (iPhone|Kindle) Touch
|
So, I finally had time to do something with this again.
For a minimal booklet it's actually quite simple. You just need to create a class that extends AbstractBooklet and adding Main-Class: your.package.path.and.BookletClass to META-INF/MANIFEST.MF and that gives you a simple empty window when started. I hijacked the booklet com.lab126.booklet.testbooklet that should be contained in /opt/amazon/ebook/booklet/testBook.jar but this jar is missing from a non-debug KT. So I didn't even have to overwrite any original files. I used a symlink for testBook.jar, so I didn't had to always do a mntroot although I still had to restart cvm for every update. Code:
mntroot rw ln -s /mnt/us/testBook.jar /opt/amazon/ebook/booklet/testBook.jar mntroot ro lipc-set-prop com.lab126.appmgrd start app://com.lab126.booklet.testbooklet Here's a link to the class' source code. I'll also attach the jar. https://gist.github.com/3762793 Wiring that booklet up to the store button is easy enough after this. Just changing in /usr/share/webkit-1.0/pillow/javascripts/search_bar.js the STORE_ID constant to app://com.lab126.booklet.testbooklet and voilà. Now I only need to extend that booklet to launch HackedUpReader. Should not be too hard. Last edited by bhaak; 10-04-2012 at 06:47 AM. Reason: typo |
09-22-2012, 12:59 PM | #7 |
Groupie
Posts: 164
Karma: 164969
Join Date: Dec 2011
Device: Palm IIIx, (iPhone|Kindle) Touch
|
It was much less cumbersome than getting the booklet to work. I had to put the jar directly at /opt/amazon/ebook/booklet/testBook.jar as the security policies didn't allow the symlinked jar to work and I didn't feel like changing them.
I added some code that sends a QUIT signal to HackedUpReader when the booklet's stop() method gets called. So far I've only seen that when you press the home button. Also when you quit HackedUpReader the booklet sends the same event as when you press the back button. I did this by calling the command line program ("lipc-set-prop com.lab126.appmgrd backward 0") as I didn't find out easily how you would do that within the Java framework. It works fine so far although sometimes it hangs for a second or two while starting or stopping. I suspect some memory shortage and it has to discard some cached stuff first. I don't think this is good enough for the general non-developing end user but it is good enough for me. I've also put the source code onto github. Last edited by bhaak; 10-04-2012 at 06:51 AM. Reason: adding github link |
02-22-2014, 08:41 AM | #8 |
Junior Member
Posts: 2
Karma: 10
Join Date: Feb 2014
Device: Kindle PW2
|
Hi!
I have a similar problem here - i wanted to use the Store button to launch KTerm. I added it to the database using the SQLite3 prompt: Code:
INSERT INTO "handlerIds" VALUES('com.lab126.kterm'); Code:
INSERT INTO "properties" VALUES('com.lab126.kterm','command','/bin/sh /mnt/us/extensions/kterm/bin/kterm.sh'); Code:
140222:143540 appmgrd[2131]: W appmgr_history:timeout_check:lipc_id=com.lab126.kterm,state=EXECUTED:Timed out waiting for app to register a lipc id Thank you very much |
02-22-2014, 09:03 AM | #9 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Perhaps register a lipc id ?
(in kterm.sh that is) |
02-22-2014, 09:15 AM | #10 |
Linux devotee
Posts: 598
Karma: 2069047
Join Date: Feb 2011
Device: Kindle 3, Kindle 4B, Kindle PW2
|
What about launching a dummy booklet from kterm.sh that will just register the ID and won't do anything else ?
|
02-22-2014, 12:17 PM | #11 |
Junior Member
Posts: 2
Karma: 10
Join Date: Feb 2014
Device: Kindle PW2
|
Thank you very much for your quick answers!
I would like to keep this as simple as possible, as it's a simple tweak, so launching a dummy booklet sounds a bit like an overkill How could i achieve this? Is there a LIPC documentation somewhere? |
02-22-2014, 01:41 PM | #12 |
but forgot what it's like
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
|
@tbx1024, you can try to modify behavior of search bar's elements without modifying stock files. As an example, here is how I added reaction to swiping over Menu button.
Useful links: how to run any program with LIPC, maybe you'll need to add DISPLAY=:0 to run Kterm. Or just use Kindle Menu (which includes KTerm). EDIT: to answer you initial question, yes, it's possible to get rid of error dialog, but not without changing Kterm's sources and recompiling. Applications from appreg.db are launched by appmgrd. appmgrd pings launched applications over LIPC, so Kterm shoud know how to answer on its start and how to notify appmgrd about exit from Kterm. Last edited by eureka; 02-22-2014 at 01:51 PM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[KT]Turn store button on search bar to browser button | aditya3098 | Kindle Developer's Corner | 74 | 05-19-2017 08:33 PM |
Warning - Kindle Store button removed from Amazon app | RCR | Apple Devices | 4 | 09-02-2011 03:35 PM |
How to make use of print button | xXxXxXxXxXx | Recipes | 2 | 05-19-2011 03:42 PM |
They had almost two years to make the delete button work | ErwinOtten | Bookeen | 19 | 01-23-2010 04:06 PM |
Could you make a script for changing button shortcut for me? | harpum | iRex | 42 | 07-13-2008 02:00 AM |