| |   |
| show-actual-battery-percent |
|
| Tested-On: 1.1 |
|
| //show actual battery percent in the system user interface. |
| //note: battery @ 100% will only charge on a new charge event or if power is <94% |
| Index: /usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js |
| =================================================================== |
| --- .orig/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js |
| +++ /usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js |
| @@ -1382,11 +1382,11 @@ handlePowerNotifications: function(paylo |
| diff --git a/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js b/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js |
| index ee479ac..ae3563c 100644 |
| --- a/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js |
| +++ b/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js |
| @@ -1435,6 +1435,10 @@ closePbapAlert: function() { |
| */ |
| handlePowerNotifications: function(payload) { |
| 12 | 8 | |
| Mojo.Log.info("SystemUI Power Payload "+ Object.toJSON(payload)); |
| // Is the battery level provided? |
| - if (payload.percent_ui != undefined) { |
| + if (payload.percent != undefined) { |
| //Save the Battery Percentage |
| - this.batteryLevel = payload.percent_ui; |
| + this.batteryLevel = payload.percent; |
| for (var i = 0; i < this.powerIndicator.length; i++) { |
| - if (payload.percent_ui > this.powerIndicator[i]) |
| + if (payload.percent > this.powerIndicator[i]) |
| continue; |
| this.lastBatteryLevel = i; |
| this.lastBatteryLevelPayload = payload; |
| @@ -1397,7 +1397,7 @@ handlePowerNotifications: function(paylo |
| $('power').className = 'battery-' + i; |
| |
| //Show Banner Message if the Battery level is below 20% |
| - var batteryalert = $L("#{percent_ui}% battery remaining").interpolate(payload); |
| + var batteryalert = $L("#{percent}% battery remaining").interpolate(payload); |
| if(this.batteryLevel <= 5 && !this.batteryLevel5Shown) { |
| this.batteryLevel5Shown = true; |
| this.showLowBatteryAlert(); |
| @@ -1423,7 +1423,7 @@ handlePowerNotifications: function(paylo |
| } |
| else { |
| Mojo.Log.info("SystemUI- Is Charging "+ this.isCharging ); |
| - if(payload.percent_ui == 100) |
| + if(payload.percent == 100) |
| $('power').className = 'battery-charged'; |
| else |
| $('power').className = 'battery-charging-' + i; |
| + //Show Actual Percent |
| + //Ugly, but it's the easiest way to keep this compatible with the Battery Icon patches. |
| + payload.percent_ui = payload.percent; |
| + |
| Mojo.Log.info("SystemUI Power Payload "+ Object.toJSON(payload)); |
| if(!this.powerdServiceUp) { |
| Mojo.Log.error("SystemUI PowerD down -- ignoring the notification"); |