File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change
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 ()
Original file line number Diff line number Diff line change
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 )
You can’t perform that action at this time.
0 commit comments