Skip to content

Implement battery percentage detection for laptop users, #2921

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

Closed
Samdasti opened this issue Jan 24, 2024 · 1 comment
Closed

Implement battery percentage detection for laptop users, #2921

Samdasti opened this issue Jan 24, 2024 · 1 comment

Comments

@Samdasti
Copy link

Add this new function - Cosmos.System.Power.GetBatteryPercentage(); - Returns the value of how many percent the battery is, this function only works for laptop users, if the user is running a desktop, it does nothing, this function can be used in an if statement to do something if the battery percentage is of a certain level, for example:
"if (Cosmos.System.Power.GetBatteryPercentage(); == 0) {
Console.WriteLine("Battery has run out, shutting down...");
System.Threading.Thread.Sleep(1);
Cosmos.System.Power.Shutdown();
}
".

@9xbt
Copy link
Contributor

9xbt commented Jan 24, 2024

Duplicate of #2503

@MishaProductions MishaProductions closed this as not planned Won't fix, can't repro, duplicate, stale Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants