View Single Post
Old 11-08-2013, 06:34 PM   #85
Aeris
Developer's Corner Mascot
Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.Aeris ought to be getting tired of karma fortunes by now.
 
Aeris's Avatar
 
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
Being similar questions asked from Gorazd too, I'll answer here:

Quote:
I didn't understand if is your graphic menu for your apps only or can be costumized. Can I use your Kindle Menu v. 0.7 for all my apps or not?
Theoretically: yes. You could add by hand the code to make your apps run even if they are not listed by default in Kindle Menu.

Quote:
How is this menu working? How do you start graphic menu? Via standard kual menu?
Yes, there is a kual menu entry to launch it, but you could launch it also from kterm. If you enable the android-like shortcut (always from KUAL), you could open the menu simply swiping from the topbar, like on android.

Kindle Menu is basically an html page, loaded by the script in /extensions/kindlemenu/bin/kindlemenu.sh file:
Code:
#!/bin/sh

lipc-set-prop com.lab126.pillow customDialog '{"name": "../../../../mnt/us/extensions/kindlemenu/bin/kindlemenupage", "clientParams": {"dismiss": true}}'
The command simply "tells" to the system to draw the html page placed in the folder /extensions/kindlemenu/bin/kindlemenupage (.html must be omitted in the path).
Due to "dismiss: true" parameter, if the script is started twice, the windows is dismissed instead of shown. You can't run every type of html files this way: your file must contain some special code, that you can easily spot opening the simpler html file in /extensions/kindlemenu/bin/html/calendar.html

Quote:
Can brick kindle paperwhite if you miss something in this custom graphic design.
Normally, not. If the html page contains some error, it will simply display that error, or in the worse case won't show at all. Being that the html page, through nativeBridge command, can execute custom code, if that code is malicious you could brick your device. But this would happen for every KUAL entry too, or typing the code directly in kterm or via USBNetwork.

Now, a little guide to add custom app entries:

GUIDE: How to add your custom app launcher to Kindle Menu

NOTICE: THE FOLLOWING GUIDE HAS BECOME OBSOLETE SINCE THE RELEASE OF KINDLE MENU V.1.4. PLEASE UPDATE YOUR APP AND REFER TO THE FIRST POST OF THIS THREAD FOR THE NEW, FASTER METHODS TO ADD CUSTOM SHORCUTS


Spoiler:

  1. Open the file /extensions/kindlemenu/bin/kindlemenupage.html with your favourite text editor
  2. Find the text
    Code:
    // ### APP LAUNCHERS FUNCTIONS ###
  3. Just below, add a new function, similar to the ones that you already see there, in the following way:
    (For this demonstration, we'll call it SampleAPP)
    Code:
    function SampleAPP(){
    nativeBridge.dismissMe();
    killallprocesses();
    nativeBridge.setLipcProperty( "com.lab126.system", "sendEvent", "; sh -c 'DISPLAY=:0 your_launch_code_goes_here'");
    }
  4. In the above code, you must replace your_launch_code_goes_here with your app launching script. To spot what it is, you must go in your app folder under "extensions" one, and open the file menu.json. In our sample, it will be something like:

    /mnt/us/extensions/SampleAPP/menu.json

    The launch code will look something like: /mnt/us/extensions/SampleAPP/bin/sample_app_launch.sh
  5. Your launch script function is now ready. You need only to add the app icon/link. Again, in the file kindlemenupage.html, search for the code:
    Code:
    <div id="appContainer">
    Just below, past this code:
    Code:
    <div class="appOuter" onclick="SampleAPP()" >
    	<div class="appIcon" style="background-image:url('icons/SampleAPP_icon.jpg');" ></div>
    	<div class="appName">SampleAPP_link_name</div>
    </div>

Where SampleAPP_icon.jpg is the name of the icon image you have prepared in KindleMenu icons subfolder. If you don't have any icon yet, don't worry, the image just won't show, but the app link will work anyway.
Replace SampleAPP_link_name with the link you want to be shown in Kindle Menu.

If you did everything well, the new app linkshould be now visible and working!


IMPORTANT: remember that updating Kindle Menu to any new version will overwrite your changes to kindlemenupage.html, hence removing your customized launchers. Do a backup of the added lines before updating, and set back the changes right after.

Last edited by Aeris; 11-26-2013 at 09:43 PM.
Aeris is offline   Reply With Quote