Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.

Send Pull Request #24

Merged
merged 4 commits into from
Jun 26, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add files via upload
  • Loading branch information
Mitesh2499 authored Jun 23, 2020
commit e9e5fffab99f272120134576dc4b86401363ea58
19 changes: 19 additions & 0 deletions projects/battery notification/battery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# pip install psutil
import psutil

battery = psutil.sensors_battery()
plugged = battery.power_plugged
percent = battery.percent

if percent >= 30:

# pip install pynotifier
# pip install win10toast
from pynotifier import Notification

Notification(
title="Battery Low",
description=str(percent) + "% Battery remain!!",
duration=5, # Duration in seconds
urgency=Notification.URGENCY_CRITICAL,
).send()