This commit is contained in:
Abhorrent_Anger 2019-10-22 14:43:20 +03:00 committed by Mārtiņš Kurmis
parent bba5143434
commit 8585ea3e1f
5 changed files with 37 additions and 2 deletions

View File

@ -2,8 +2,18 @@
A small background tool to remind the user of the "20-20-20" rule. Uses system notifications and sound cues.
First, you might need these packages:
```
sudo apt-get install python-gobject libnotify-bin python-gst-1.0
pip3 install notify2 playsound --user
```
Second, just install the required [Python modules](src/branch/master/setup.py) via:
```
python setup.py install --user
```
Or to remove:
```
pip remove eyestrainreminder
```

View File

@ -0,0 +1 @@
from .main import *

View File

@ -10,6 +10,7 @@ MILLISECOND = 1000
MINUTE = 60
def init():
print("Initializing EyeStrainReminder...")
notify2.init(NAME)
def uninit():
@ -19,6 +20,7 @@ def wait():
sleep(TIMEOUT*MINUTE)
def send_notification():
print(MESSAGE)
notification = notify2.Notification(NAME, MESSAGE, "notification-device-eject")
notification.set_timeout(TIMEOUT * MILLISECOND)
notification.set_urgency(notify2.URGENCY_LOW)
@ -28,9 +30,12 @@ def send_notification():
notification.close()
playsound('files/default.wav')
if __name__ == '__main__':
def main():
init()
while 1:
wait()
send_notification()
uninit()
uninit()
if __name__ == '__main__':
main()

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
notify2>=0.3.1
playsound>=1.2.2

17
setup.py Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env python
from setuptools import setup
#from distutils.core import setup
setup(name='EyeStrainReminder',
version='1.0',
description='A small background tool to remind the user of the “20-20-20” rule.',
author='Abhorrent Anger',
author_email='abhorrentanger@cock.li',
url='https://git.pube.tk/abhorrent_anger/EyeStrainReminder',
packages=['eyestrainreminder'],
entry_points = {
'console_scripts': [
'eyestrainreminder = eyestrainreminder.main:main'
]
},
)