mirror of
https://github.com/metafy-social/python-scripts.git
synced 2024-11-30 15:31:10 +00:00
19 lines
436 B
Python
19 lines
436 B
Python
# 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() |