From df120d9fbb84d077b233dbec083678068aca3507 Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Sat, 9 Dec 2023 21:29:04 +0100 Subject: [PATCH] Fix clearing timer --- .bin/pomo | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.bin/pomo b/.bin/pomo index 53a7f5d..dd36778 100755 --- a/.bin/pomo +++ b/.bin/pomo @@ -15,8 +15,9 @@ from time import sleep from plyer import notification +@atexit.register def clear(): - os.system('echo -n "" > /tmp/pomo') + os.system('rm /tmp/pomo') def format_mins_secs(mins, secs): @@ -36,8 +37,6 @@ def make_countdown(): def main(args): - atexit.register(clear) - prep_duration = args.prep_duration * 60 work_duration = args.work_duration * 60 break_duration = args.break_duration * 60 @@ -59,7 +58,15 @@ def main(args): repeats -= 1 +def handle_signal(signal, frame): + # Wait for clear to finish + clear() + print('Exiting') + exit(0) + + if __name__ == '__main__': + parser = ArgumentParser() parser.add_argument('-p', '--prep-duration', type=int,