added restart button
This commit is contained in:
11
src/main.pyw
11
src/main.pyw
@@ -12,6 +12,7 @@ from config import load_config, save_config, get_shortcut
|
||||
from startup import add_to_startup, remove_from_startup, is_in_startup
|
||||
import os
|
||||
import atexit
|
||||
import sys
|
||||
|
||||
def convert_en_characters(input_str):
|
||||
"""
|
||||
@@ -137,6 +138,15 @@ def quit_app(icon, item):
|
||||
import os
|
||||
os._exit(0)
|
||||
|
||||
def restart_app(icon, item):
|
||||
icon.stop()
|
||||
cleanup_lock()
|
||||
import subprocess
|
||||
python = sys.executable
|
||||
script = os.path.abspath(__file__)
|
||||
subprocess.Popen([python, script])
|
||||
os._exit(0)
|
||||
|
||||
def setup_tray(config):
|
||||
def on_toggle_lang_change(icon, item):
|
||||
config["lang_change"] = not item.checked
|
||||
@@ -163,6 +173,7 @@ def setup_tray(config):
|
||||
on_toggle_startup,
|
||||
checked=lambda item: config["run_on_startup"]
|
||||
),
|
||||
pystray.MenuItem('Restart', restart_app),
|
||||
pystray.MenuItem('Quit', quit_app)
|
||||
)
|
||||
icon = pystray.Icon("oopswronglang", image, "OopsWrongLang", menu)
|
||||
|
||||
Reference in New Issue
Block a user