From 8e3bd02af4224a4a2fd1ed7039be471b99b02a67 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 23 Feb 2026 21:48:09 +0700 Subject: [PATCH 1/2] add sign before battery rate status --- sensors.js | 7 +++++-- values.js | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sensors.js b/sensors.js index f310161..6f8f353 100644 --- a/sensors.js +++ b/sensors.js @@ -427,8 +427,11 @@ export const Sensors = GObject.registerClass({ } if ('POWER_NOW' in output) { - this._returnValue(callback, 'Rate', output['POWER_NOW'], 'battery', 'watt'); - this._returnValue(callback, 'battery', output['POWER_NOW'], 'battery-group', 'watt'); + const powerValue = ( + parseFloat(output['POWER_NOW']) * (output['STATUS'] === 'Discharging' ? -1 : 1) + ); + this._returnValue(callback, 'Power Rate', powerValue, 'battery', 'watt'); + this._returnValue(callback, 'battery', powerValue, 'battery-group', 'watt'); } if ('CHARGE_FULL' in output && 'VOLTAGE_MIN_DESIGN' in output && (!('ENERGY_FULL' in output))) { diff --git a/values.js b/values.js index a7cabb0..da83d3f 100644 --- a/values.js +++ b/values.js @@ -186,7 +186,9 @@ export const Values = GObject.registerClass({ ending = 'mAh'; break; case 'watt': - format = (use_higher_precision)?'%.2f %s':'%.1f %s'; + format = ( + ((value > 0) ? '+' : '') + ((use_higher_precision)?'%.2f %s':'%.1f %s') + ); value = value / 1000000; ending = 'W'; break; From 0d2746e0d471c20ea0be89c431131129233201a2 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 23 Feb 2026 22:15:02 +0700 Subject: [PATCH 2/2] add sign before battery rate status --- sensors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sensors.js b/sensors.js index 6f8f353..cfb22f3 100644 --- a/sensors.js +++ b/sensors.js @@ -429,7 +429,7 @@ export const Sensors = GObject.registerClass({ if ('POWER_NOW' in output) { const powerValue = ( parseFloat(output['POWER_NOW']) * (output['STATUS'] === 'Discharging' ? -1 : 1) - ); + ); this._returnValue(callback, 'Power Rate', powerValue, 'battery', 'watt'); this._returnValue(callback, 'battery', powerValue, 'battery-group', 'watt'); }