10-21-2013, 05:19 AM | #1 |
Developer's Corner Mascot
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Battery % in the tray - KUAL app for kindles is now READY!
Finally we have a tiny app to display the battery % in the system tray. All credits for this go to Eureka (see this post for the original code: https://www.mobileread.com/forums/sho...87&postcount=8).
I've only set up this KUAL launcher and tuned a bit the layout to give it a native look on Kindle Paperwhite. I couldn't test it on Kindle Touch, so every feedback and screenshots on this device are welcome. Once launched the KUAL shortcut, changes will persist until the next system (or framework) reboot. Its work range is 10%-100% If it doesn't show the first time, restart kindle and retry. Update: now it should work properly both on Touch and PW Update 2: it has been reported that on touches devices it shows in different ways depending on the firmware version. Try to play with marginLeft and marginTop values in the script to fit better your needs, reapplying the patch each time you change something. Last edited by Aeris; 10-21-2013 at 10:30 AM. Reason: Added Twobob's code |
10-21-2013, 05:45 AM | #2 |
Evangelist
Posts: 456
Karma: 1287375
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
|
Sucess on a Touch! Looks pretty good - there is a tiny line above the 99% that looks like it might be from the battery icon. Still usable, just not perfect. I haven't looked at code yet.
|
Advert | |
|
10-21-2013, 05:47 AM | #3 |
Developer's Corner Mascot
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
I'll make two different versions then. If you post the screenshot I'll try to fix it! Just have to change a single value. Thanks for report
|
10-21-2013, 06:05 AM | #4 |
Evangelist
Posts: 456
Karma: 1287375
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
|
percentage doesn't show while plugged in, so a screenshot wouldn't show unless I used kterm? What value to change - paddingTop or Height?
|
10-21-2013, 06:11 AM | #5 |
Developer's Corner Mascot
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Yes, you must plug off it, take the screenshot then plug it in again.
Try to set _batteryMeterEl.style.marginTop="-1.6pt"; |
Advert | |
|
10-21-2013, 06:14 AM | #6 |
Evangelist
Posts: 456
Karma: 1287375
Join Date: Jan 2013
Location: West Gardiner, Maine
Device: Touch (5.3.7)
|
yep, much nicer. Thanks! I'll probably play around with the numbers a bit to see what I like best.
|
10-21-2013, 06:16 AM | #7 |
Developer's Corner Mascot
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Ok, when you are done please send a screenie and your folder so we can make a Kindle touch dedicated zip too, and attach both files to the post. You can take inspiration from kindle PW screen, so we could make an app that looks the same in both models Thank you!
|
10-21-2013, 08:57 AM | #8 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
one release fits all :
Code:
#!/bin/sh SCRIPT="" PLATFORM="$(cat /sys/devices/platform/mxc_epdc_fb/graphics/fb0/modes)" if [ "$PLATFORM" = "${PLATFORM/758/}" ]; then #Touch #setup touch version of stuff SCRIPT=`cat << 'JAVASCRIPT' | tr -d '\n' | sed -e 's,",\\\\",g' (function () { var _batteryMeterId = BatteryState.batteryFillDiv, _batteryMeterEl = _batteryMeterId && document.getElementById(_batteryMeterId), _currentBatteryLevel = nativeBridge.getIntLipcProperty("com.lab126.powerd", "battLevel"), _originalResolveLabel = BatteryState.resolveLabel; if (!_batteryMeterEl || !_originalResolveLabel) { return; } /* Text should be WHITE to be visible. */ _batteryMeterEl.style.color = "white"; /* Hack style to set vertical alignment of text. */ _batteryMeterEl.style.lineHeight = "5.2pt"; /* Add style for smaller font size. */ _batteryMeterEl.style.fontSize = "7.2pt"; /* Background color for hiding the battery */ _batteryMeterEl.style.backgroundColor="black"; _batteryMeterEl.style.marginTop="-1.6pt"; _batteryMeterEl.style.marginLeft="-2pt"; _batteryMeterEl.style.width="20pt"; _batteryMeterEl.style.minWidth="20pt"; _batteryMeterEl.style.height="12pt"; _batteryMeterEl.style.paddingTop="0.8pt"; if (_currentBatteryLevel) { _batteryMeterEl.textContent = _currentBatteryLevel + "%"; } BatteryState.resolveLabel = function () { var batteryMeterId = BatteryState.batteryFillDiv, batteryMeterEl = batteryMeterId && document.getElementById(batteryMeterId); _originalResolveLabel(); if (batteryMeterEl) { batteryMeterEl.textContent = BatteryState.percent + "%"; } }; })(); ` fi if [ "$PLATFORM" != "${PLATFORM/758/}" ]; then #It's a PW #setup PW version of stuff... SCRIPT=`cat << 'JAVASCRIPT' | tr -d '\n' | sed -e 's,",\\\\",g' (function () { var _batteryMeterId = BatteryState.batteryFillDiv, _batteryMeterEl = _batteryMeterId && document.getElementById(_batteryMeterId), _currentBatteryLevel = nativeBridge.getIntLipcProperty("com.lab126.powerd", "battLevel"), _originalResolveLabel = BatteryState.resolveLabel; if (!_batteryMeterEl || !_originalResolveLabel) { return; } /* Text should be WHITE to be visible. */ _batteryMeterEl.style.color = "white"; /* Hack style to set vertical alignment of text. */ _batteryMeterEl.style.lineHeight = "5.2pt"; /* Add style for smaller font size. */ _batteryMeterEl.style.fontSize = "7.2pt"; /* Background color for hiding the battery */ _batteryMeterEl.style.backgroundColor="black"; _batteryMeterEl.style.marginTop="-1.4pt"; _batteryMeterEl.style.marginLeft="-2pt"; _batteryMeterEl.style.width="20pt"; _batteryMeterEl.style.minWidth="20pt"; _batteryMeterEl.style.height="12pt"; _batteryMeterEl.style.paddingTop="0.8pt"; if (_currentBatteryLevel) { _batteryMeterEl.textContent = _currentBatteryLevel + "%"; } BatteryState.resolveLabel = function () { var batteryMeterId = BatteryState.batteryFillDiv, batteryMeterEl = batteryMeterId && document.getElementById(batteryMeterId); _originalResolveLabel(); if (batteryMeterEl) { batteryMeterEl.textContent = BatteryState.percent + "%"; } }; })(); ` fi MESSAGE='{ "pillowId": "default_status_bar", "function": "'${SCRIPT}'" }' lipc-set-prop -s com.lab126.pillow interrogatePillow "$MESSAGE" Last edited by twobob; 10-21-2013 at 11:21 AM. Reason: dont matter if you're black or you're white. |
10-21-2013, 10:10 AM | #9 |
Developer's Corner Mascot
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Package updated, thank you!
|
10-21-2013, 10:19 AM | #10 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
small note..
There appears to be a minute disparity in Touch FW versions... Pictured. Ancient and New. So, yeah... Just mentioning it. |
10-21-2013, 10:24 AM | #11 |
Developer's Corner Mascot
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Ok, if anybody see it in some bady way just ask. P.s. TO USERS: in the new (or old) version maybe it could look better with a positive and sligthly higher marginLeft value instead, in the other, it needs a more negative marginTop.
Last edited by Aeris; 10-21-2013 at 10:30 AM. |
10-21-2013, 11:18 AM | #12 |
but forgot what it's like
Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
|
|
10-21-2013, 11:20 AM | #13 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
heh yeah I clocked that too...
in your original that was of course the case I'll edit my posted code. just for the sake of it. |
10-21-2013, 11:21 AM | #14 |
Developer's Corner Mascot
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Ahahahah my bad, I forgot to change it xD
|
10-21-2013, 11:31 AM | #15 |
Developer's Corner Mascot
Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Do you think guys that it would be easy, for example, with a similar approach, turn the wifi tray icon into a switch for the wifi off/on property? Inejcting some javascript as in this case... or javascript can't launch lipc commands?
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
support for IBM/360/370/S-390 code on the Kindles (KUAL) | knc1 | Kindle Developer's Corner | 63 | 01-08-2014 06:02 PM |
Bible app for e-ink Kindles (Kindle Active Content) | draytonbenner | Self-Promotions by Authors and Publishers | 0 | 10-18-2012 10:23 AM |
iPad Amazon’s Kindle iOS app now ready for the new iPad’s Retina*Display | monkeyluis | Apple Devices | 9 | 03-18-2012 08:27 PM |
A tray app for Calibre ? | thomass | Calibre | 3 | 08-21-2011 05:19 PM |
So is the Iliad really production ready and is the market ready for e-readers? | pdam | iRex | 28 | 09-14-2006 05:24 PM |