File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed
Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 1- import os
2-
3- import util
41import actions
52
63# Available actions:
Original file line number Diff line number Diff line change @@ -101,5 +101,19 @@ def run():
101101
102102if __name__ == "__main__" :
103103 multiprocessing .freeze_support ()
104- threading .Thread (target = run ).start ()
105- util .functions .icon .run ()
104+
105+ def run_with_watchdog ():
106+ try :
107+ run ()
108+ except asyncio .CancelledError :
109+ pass
110+
111+ run_thread = threading .Thread (target = run_with_watchdog , daemon = True )
112+ run_thread .start ()
113+
114+ try :
115+ util .functions .icon .run ()
116+ finally :
117+ if run_thread .is_alive ():
118+ asyncio .get_event_loop ().stop ()
119+ run_thread .join ()
Original file line number Diff line number Diff line change @@ -283,7 +283,7 @@ def take_break():
283283 ),
284284 pystray .MenuItem (
285285 "Exit" ,
286- lambda : os ._exit (0 ),
286+ lambda icon : ( icon . stop (), os ._exit (0 ) ),
287287 ),
288288 ),
289289)
You can’t perform that action at this time.
0 commit comments