From 94187799109ad11c6f040d8a883d4cb272423820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=98=88=ED=99=98=20Ye-Hwan=20Kim=20=28Sam=29?= Date: Sun, 21 Jul 2024 15:37:29 +0900 Subject: [PATCH] Fix notification --- README.md | 2 +- package.json | 2 +- renderer.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a7f86ab..6848a49 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ npm i npm run make ``` -2. Unzip `out/make/zip/darwin/arm64/Battery Status-darwin-arm64-2024.1.0.zip` +2. Unzip `out/make/zip/darwin/arm64/Battery Status-darwin-arm64-#.#.#.zip` 3. Move `Battery Status.app` to the `Applications` folder 4. (Optional) Add `Battery Status.app` in `System Settings` > `General` > `Login Items` > `+` to run `Battery Status` on computer startup 5. Run `Battery Status.app` diff --git a/package.json b/package.json index 09c16ba..589e1ad 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "productName": "Battery Status", "name": "battery-status", - "version": "2024.1.0", + "version": "2024.7.0", "description": "Program that notifies the user when it's time to plug in or unplug the laptop to maximize the battery life", "license": "LGPL-3.0-or-later", "author": { diff --git a/renderer.js b/renderer.js index c6ee7fe..c9970d0 100644 --- a/renderer.js +++ b/renderer.js @@ -27,18 +27,18 @@ function main() { navigator.getBattery().then((batteryManager) => { batteryManager.addEventListener("levelchange", (_event) => { - const level = batteryManager.level * 100; + const level = Math.round(batteryManager.level * 100); if (batteryManager.charging) { if (level >= 80) { - sendNotification("Battery sufficiently charged"); + sendNotification(`You might want to unplug your PC (${level}%)`); } return; } if (level <= 20) { - sendNotification(`Low Battery: ${level}% battery remaining`); + sendNotification(`You might want to plug in your PC (${level}%)`); } }); });