Skip to content

Commit 073cc30

Browse files
committed
Fixed a non-working autostart due to UAC
1 parent 0f38284 commit 073cc30

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

resources/startup.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@echo off
2+
REM Workaround for start with UAC
3+
start "" "%~1"
4+
exit

src/util/path.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,14 @@ def get_tray_icon() -> str:
3131
str: The path to the tray icon file.
3232
"""
3333
return f"{get_root()}/resources/app.ico"
34+
35+
36+
def get_startup_script() -> str:
37+
"""
38+
Returns the path to the startup script.
39+
40+
Returns:
41+
str: The path to the startup script.
42+
"""
43+
return f"{get_root()}/resources/startup.bat"
44+

src/util/startup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
import winshell
55

6+
from util.path import get_startup_script
7+
68

79
def startup_link_path():
810
"""
@@ -31,13 +33,11 @@ def create_startup_link():
3133
return
3234

3335
with winshell.shortcut(link_path) as link:
34-
link.path = f"\"{sys.executable}\""
36+
link.path = f"\"{get_startup_script()}\""
3537
link.description = "Process Governor"
3638
link.icon_location = (sys.executable, 0)
3739
link.working_directory = os.getcwd()
38-
39-
if not getattr(sys, 'frozen', False):
40-
link.arguments = f"\"{sys.argv[0]}\""
40+
link.arguments = f"\"{sys.executable}\""
4141

4242

4343
def remove_startup_link():

0 commit comments

Comments
 (0)