Merge pull request #268 from Danuragtiwari/new

battery notification added
This commit is contained in:
Advaita Saha 2022-10-09 21:35:18 +05:30 committed by GitHub
commit 800f1f8cb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,13 @@
This python File used to give notification about your battery percentage of the device.
Pre-requisites:-you need to install python on your desktop along with some awesome packages as follows:-
1.)psutil :-pip install psutil
2.)pynotifier :- pip install py-notifier
3.)win10toast :- pip install win10toast
thanks for reading!!

View File

@ -0,0 +1,19 @@
# pip install psutil
import psutil
battery = psutil.sensors_battery()
plugged = battery.power_plugged
percent = battery.percent
if percent <= 30 and plugged!=True:
# pip install py-notifier
# pip install win10toast
from pynotifier import Notification
Notification(
title="Battery Low",
description=str(percent) + "% Battery remain!!",
duration=5, # Duration in seconds
).send()

View File

@ -0,0 +1,3 @@
psutil==5.7.2
py-notifier==0.1
win10toast==0.9