diff --git a/package/contents/ui/lib/helper.js b/package/contents/ui/lib/helper.js index 72c6094..5beafee 100644 --- a/package/contents/ui/lib/helper.js +++ b/package/contents/ui/lib/helper.js @@ -7,7 +7,7 @@ function batteryColor(batteryPercent) { switch(batteryPercent) { case -1: color = "green"; break; case -2: color = "red"; break; - default: color = colors[~~(batteryPercent / 10 + 0.5)]; break; + default: color = colors[~~(batteryPercent / 10 + 0.5) - 1]; break; } return color; } diff --git a/package/contents/ui/main.qml b/package/contents/ui/main.qml index 89c9fe7..bf190ab 100644 --- a/package/contents/ui/main.qml +++ b/package/contents/ui/main.qml @@ -18,7 +18,7 @@ Item { connectedSources: ["headsetcontrol -bc"] interval: pollingrate * 1e3 onNewData: { - if(data['exit_code'] > 0) { + if(data['exit code'] > 0) { batteryPercent = -2; return; }