fix exit code and color

This commit is contained in:
Flummi 2024-01-20 03:20:23 +01:00
parent ecf5c67ffb
commit c36eb8daae
Signed by: Flummi
GPG Key ID: AA2AEF822A6F4817
2 changed files with 2 additions and 2 deletions

View File

@ -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;
}

View File

@ -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;
}