forked from linrakesh/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotifier.py
More file actions
32 lines (22 loc) · 702 Bytes
/
notifier.py
File metadata and controls
32 lines (22 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import time
import notify2
from topNews import topStories
# path to notification window icon
ICON_PATH = "put full path to icon image here"
# fetch news items
newsitems = topStories()
# initialise the d-bus connection
notify2.init("News Notifier")
# create Notification object
n = notify2.Notification(None, icon = ICON_PATH)
# set urgency level
n.set_urgency(notify2.URGENCY_NORMAL)
# set timeout for a notification
n.set_timeout(10000)
for newsitem in newsitems:
# update notification data for Notification object
n.update(newsitem['title'], newsitem['description'])
# show notification on screen
n.show()
# short delay between notifications
time.sleep(15)