Command line params

This commit is contained in:
Abhorrent_Anger 2019-10-29 10:33:03 +02:00 committed by Mārtiņš Kurmis
parent 5e2f3a697f
commit 8fb24be336
3 changed files with 16 additions and 5 deletions

View File

@ -16,7 +16,8 @@ Run it simply with, or preferably put it to run on boot as:
```
$ eyestrainreminder
```
Or to remove:
Optional parameters can be viewed through "$ eyestrainreminder -h", but let you mute the notification sound, turn off notifications by default and invert the tray icon colors.
In order to remove it, just run:
```
pip uninstall EyeStrainReminder
```

View File

@ -18,9 +18,9 @@ MINUTE = 60
DIR = os.path.dirname(os.path.abspath(__file__))
icon = None
mute = False
disable_notifications = False
invert_icons = False
#mute = False
#disable_notifications = False
#invert_icons = False
notify_thread = None
def init():
@ -96,6 +96,15 @@ def play_sound():
if not mute:
playsound(f"{DIR}/files/default.wav")
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("-m", "--mute", action="store_true", default=False, help="Mute notification sounds by default")
parser.add_argument("-n", "--disable_notifications", action="store_true", default=False, help="Disable notifications by default")
parser.add_argument("-i", "--invert_icons", action="store_true", default=False, help="Default to the dark icon for light themes")
args = parser.parse_args()
globals().update(args.__dict__)
def main():
init()
while 1:
@ -104,6 +113,7 @@ def main():
uninit()
if __name__ == '__main__':
parse_args()
notify_thread = threading.Thread(target=main, name="Notify Thread")
notify_thread.start()
create_tray_icon()

View File

@ -1 +1 @@
from .__main__ import *
from .EyeStrainReminder import *