Command line params
This commit is contained in:
parent
5e2f3a697f
commit
8fb24be336
|
@ -16,7 +16,8 @@ Run it simply with, or preferably put it to run on boot as:
|
||||||
```
|
```
|
||||||
$ eyestrainreminder
|
$ 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
|
pip uninstall EyeStrainReminder
|
||||||
```
|
```
|
|
@ -18,9 +18,9 @@ MINUTE = 60
|
||||||
DIR = os.path.dirname(os.path.abspath(__file__))
|
DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
icon = None
|
icon = None
|
||||||
mute = False
|
#mute = False
|
||||||
disable_notifications = False
|
#disable_notifications = False
|
||||||
invert_icons = False
|
#invert_icons = False
|
||||||
notify_thread = None
|
notify_thread = None
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
|
@ -96,6 +96,15 @@ def play_sound():
|
||||||
if not mute:
|
if not mute:
|
||||||
playsound(f"{DIR}/files/default.wav")
|
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():
|
def main():
|
||||||
init()
|
init()
|
||||||
while 1:
|
while 1:
|
||||||
|
@ -104,6 +113,7 @@ def main():
|
||||||
uninit()
|
uninit()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
parse_args()
|
||||||
notify_thread = threading.Thread(target=main, name="Notify Thread")
|
notify_thread = threading.Thread(target=main, name="Notify Thread")
|
||||||
notify_thread.start()
|
notify_thread.start()
|
||||||
create_tray_icon()
|
create_tray_icon()
|
|
@ -1 +1 @@
|
||||||
from .__main__ import *
|
from .EyeStrainReminder import *
|
Loading…
Reference in New Issue