From bf286de1db011e040694be46c73c7e914e1b4a32 Mon Sep 17 00:00:00 2001 From: pux Date: Fri, 3 Apr 2020 00:39:22 +0200 Subject: add notify-send msg --- timebomb.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'timebomb.py') diff --git a/timebomb.py b/timebomb.py index bd9e594..c62eedc 100644 --- a/timebomb.py +++ b/timebomb.py @@ -10,6 +10,7 @@ from tkinter import Canvas import argparse import time import shutil +import notify2 root = Tk() @@ -17,6 +18,11 @@ def message(m, s): screen_width = root.winfo_screenwidth() screen_height = root.winfo_screenheight() + msg = 'ALARM, Timer ran ' + str(m) + 'm and ' + str(s) + ' s' + + notify_msg = notify2.Notification('ALARM', msg) + notify_msg.show() + if screen_width <= 0: screen_width = 1024 if screen_height <= 0: @@ -25,8 +31,7 @@ def message(m, s): c = Canvas(root, bg = "darkred", \ width = screen_width, height = screen_height) c.pack() - messagebox.showwarning('ALARM', 'Timer ran ' + str(m) + ' m and ' \ - + str(s) + ' s') + messagebox.showwarning(msg) #root.mainloop() def main(): @@ -56,6 +61,8 @@ def main(): time_m = abs(args.m[0]) if args.s or args.m: + + notify2.init('timebomb') sleep(m=time_m, s=time_s) message(m=time_m, s=time_s) -- cgit v1.2.2-1-g5e49