Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for feature: More battery information #58

Open
beyenilmez opened this issue Dec 13, 2023 · 2 comments
Open

Request for feature: More battery information #58

beyenilmez opened this issue Dec 13, 2023 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@beyenilmez
Copy link
Contributor

I noticed onNativeBatteryLevelEvent only returns battery level. However, upon reviewing the code, it appears that additional information such as charging status, full lifetime of battery in seconds, remaining battery life in seconds and power line status can be retrieved too. More detailed widgets can be created with these.

A new event called onNativeBatteryEvent can return a JSON like this.
(onNativeBatteryLevelEvent can be renamed to onNativeBatteryEvent too.)

{
batteryChargeStatus: "Charging",
batteryFullLifetime: 18000,
batteryLifePercent: 58,
batteryLifeRemaining : -1,
powerLineStatus: "Online",
}

The template battery widget can be updated to show charging status and remaining battery time with this new event.

I'm willing to create a pull request to implement this.

@beyluta
Copy link
Owner

beyluta commented Dec 13, 2023

It would be great if you could create a PR! I currently don't have a windows laptop which I can use to test the battery feature.

Doing this would break existing user widgets, but since there's no automatic updates; I think it's ok. I can add a warning to the patch notes that widgets relying on this feature will need to be tweaked.

beyenilmez added a commit to beyenilmez/WinWidgets that referenced this issue Dec 14, 2023
* modified onNativeBatteryLevelEvent
* updated template battery widget to show charging status and remaining time
* updated the index.html to show the usage of the new event
beyluta added a commit that referenced this issue Dec 14, 2023
@beyluta
Copy link
Owner

beyluta commented Dec 14, 2023

I've merged into development for now. Code looks good but I sadly can't test it right now since I don't have a windows laptop at hand. But I will try to get one soon.

@beyluta beyluta added enhancement New feature or request good first issue Good for newcomers labels Dec 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants