Skip to content

Commit 4015e8f

Browse files
Merge pull request #1719 from gulshanjakhon/low_battery_scripy
Low battery script
2 parents 9400018 + 1b04329 commit 4015e8f

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import psutil
2+
battery = psutil.sensors_battery()
3+
plugged = battery.power_plugged
4+
percent = battery.percent
5+
if percent <= 55 and plugged!=True:
6+
from pynotifier import Notification
7+
Notification(
8+
title="Battery Low",
9+
description=str(percent) + "% Battery remain!!",
10+
duration=5,
11+
).send()

Low_battery_alert/readme.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
# low_battery_alert.py
3+
4+
It will popup a message displaying Low battery
5+
6+
## Requirements
7+
8+
For this script to run you need to have psutil and py-notifier packages installed on your system or you can install by using below instructions:
9+
10+
## Setup instructions
11+
12+
`pip install psutil`
13+
14+
`pip install py-notifier`
15+
16+
`pip install win10toast`
17+
18+
19+
Run the program using command
20+
21+
22+
`python low_battery_alert.py`
23+
## Output
24+
25+
`
26+
27+
`
28+
29+
## Author(s)
30+
31+
[Gulshan Kumar Jakhon](https://github.com/gulshanjakhon)

0 commit comments

Comments
 (0)