![]() |
#1 |
Developer's Corner Mascot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
lipc-daemon usage infos and ideas
Hi there! I'm trying to understand how does lipc-deamon work. If a type lipc-daemon in kterm it says:
lipc-daemon provides a way to execute programs on specified events and a way to run program to publish properties easily Usage: lipc-daemon [-e <event-config-file>] [-p <property-confi-file>] [-f] -f: Do not daemonize For example you could run: /usr/bin/lipc-daemon -p /etc/lipc-daemon-props.conf -e /etc/lipc-daemon-events.conf, where those files are already present on system (and cointains further infos too). Anyway I don't know what happens if you do :P I still can't figure out exactly how to use it xD That's what I would like to do: listen on battery level update events (i.e. when battery loses 1%) and print out somewhere the updated value (my dream would be appening it to current app name in the topbar, even if by now I'm only able to replace it). Do you think is this possibile without consuming resources, maybe using lipc-daemon? I still can't resign myself to not have a battery percentage gauge around the screen ALWAYS xD Thanks in advance. |
![]() |
![]() |
![]() |
#2 | |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
For example, I have one here with 10x the storage capacity of the Kindle's internal battery and the Kindle sees it as an external charger (which it is). This model has a tiny back lighted screen which shows the remaining storage capacity. Do not let your Avatar read the following! Spoiler:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299993
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
|
subscribe to an event of your choice.
trigger something to happen when it fires. |
![]() |
![]() |
![]() |
#4 | |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299993
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
|
Quote:
|
|
![]() |
![]() |
![]() |
#5 |
Penguin
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,017
Karma: 4742434
Join Date: Jul 2012
Device: Kindle Touch 5.3.2.1
|
On a touch at least this you could get the battery level like this:
Code:
lipc-get-prop com.lab126.powerd battLevel |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299993
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
|
she was doing that already. but yeah and only print when value updates...
|
![]() |
![]() |
![]() |
#7 | |
Developer's Corner Mascot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#8 |
but forgot what it's like
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
|
So here is a script to display battery charge as a number (percent) on top of battery icon in top bar (only when not charging and charge is more than 10 percent). It works on KT, but I didn't test it thoroughly, sorry for bugs.
It is a shell script, so copy it to file (for example) script.sh and run it as sh script.sh once after pillow (re)start. Code:
#!/bin/sh 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 black to be visible. */ _batteryMeterEl.style.color = "black"; /* Hack style to set vertical alignment of text. */ _batteryMeterEl.style.lineHeight = "3.9pt"; /* Add style for smaller font size. */ _batteryMeterEl.style.fontSize = "5pt"; if (_currentBatteryLevel) { _batteryMeterEl.textContent = _currentBatteryLevel; } BatteryState.resolveLabel = function () { var batteryMeterId = BatteryState.batteryFillDiv, batteryMeterEl = batteryMeterId && document.getElementById(batteryMeterId); _originalResolveLabel(); if (batteryMeterEl) { batteryMeterEl.textContent = BatteryState.percent; } }; })(); ` MESSAGE='{ "pillowId": "default_status_bar", "function": "'${SCRIPT}'" }' lipc-set-prop -s com.lab126.pillow interrogatePillow "$MESSAGE" |
![]() |
![]() |
![]() |
#9 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299993
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
|
works perfectly on a PW, just so you know.
|
![]() |
![]() |
![]() |
#10 |
Developer's Corner Mascot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Eureka!!! That's wonderful!!!! Thank you so much, didn't think it was possible to make a so perfect solution! Well done!
Thanks also to Twobob and Niluje for all the help that they gave me today ![]() Now just have to test if when the charge is under 50% the number is still readable Last edited by Aeris; 10-20-2013 at 04:05 PM. |
![]() |
![]() |
![]() |
#11 |
Developer's Corner Mascot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Btw I can't understand how could you make a such incredible code... do you work for amazon maybe? XD
|
![]() |
![]() |
![]() |
#12 |
but forgot what it's like
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
|
Thanks. Number under 50 will certainly be unreadable, as it will be in black font on black background. Fix is possible (as well as displaying number when Kindle is charging or signaling about low charge), but it's tiresome enough to being out of my current fun zone, so I hope someone else will do it (help me!
![]() Just look at /usr/share/webkit-1.0/pillow/default_status_bar.html and scripts included in this page. In my shell script, text between SCRIPT line and last backquote before MESSAGE is plain JavaScript code executing in context of that HTML page. (Don't use line comments, as this code is glued in one big line before passing it to pillow.) |
![]() |
![]() |
![]() |
#13 |
Developer's Corner Mascot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 486
Karma: 1277790
Join Date: Sep 2013
Device: Kindle Paperwhite 5.3.4, Kindle Keyboard 3.4
|
Great! Thanks for references
![]() |
![]() |
![]() |
![]() |
#14 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Nov 2014
Device: Kindle PW2
|
![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
LIPC: how to set a custom event? | silver18 | Kindle Developer's Corner | 20 | 04-21-2025 10:36 AM |
Adding USBNetworking Icon to StatusBar (catch lipc-set-prop event with nativeBridge) | MaPePeR | Kindle Developer's Corner | 0 | 07-05-2012 02:10 PM |
calibre server any way to have as daemon | MasterCATZ | Calibre | 8 | 05-11-2012 02:00 PM |
DR1000 I need 2 infos from dr1000s owners | repods | iRex | 22 | 06-30-2010 07:09 PM |
DR800 I would need 2 more infos about the reader.. | repods | iRex | 24 | 06-24-2010 05:42 AM |