Skip to content

Commit 4f64059

Browse files
committed
Add tray Startup shortcut option to installer
1 parent ede09c8 commit 4f64059

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

install_dependencies.bat

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ echo.
5858
echo Dependencies installed successfully.
5959
echo.
6060
call :offer_listener_startup
61+
call :offer_tray_startup
6162
goto :end_ok
6263

6364
:find_python
@@ -124,3 +125,46 @@ goto :end_ok
124125

125126
:listener_startup_done
126127
exit /b 0
128+
129+
:: ----------------------------------------------
130+
:: Helper: Offer Tray auto-start on login
131+
:: ----------------------------------------------
132+
:offer_tray_startup
133+
echo.
134+
echo Chronos Tray provides quick timer and schedule controls from the system tray.
135+
echo You can have it start automatically when you sign in to Windows.
136+
echo.
137+
choice /C YN /N /M "Add 'Chronos Tray' to your Startup folder so it runs on sign-in? [Y/N]: "
138+
if errorlevel 2 goto tray_startup_no
139+
if errorlevel 1 goto tray_startup_yes
140+
goto tray_startup_done
141+
142+
:tray_startup_yes
143+
if not exist "%ROOT_DIR%tray_launcher.bat" (
144+
echo Warning: tray_launcher.bat not found. Skipping tray shortcut creation.
145+
goto tray_startup_done
146+
)
147+
echo Creating Startup shortcut for Chronos Tray...
148+
powershell -NoProfile -Command ^
149+
"$shell = New-Object -ComObject WScript.Shell; " ^
150+
"$startup = [Environment]::GetFolderPath('Startup'); " ^
151+
"$target = Join-Path -Path '%ROOT_DIR%' -ChildPath 'tray_launcher.bat'; " ^
152+
"$shortcutPath = Join-Path -Path $startup -ChildPath 'Chronos Tray.lnk'; " ^
153+
"$shortcut = $shell.CreateShortcut($shortcutPath); " ^
154+
"$shortcut.TargetPath = $target; " ^
155+
"$shortcut.WorkingDirectory = '%ROOT_DIR%'; " ^
156+
"$shortcut.WindowStyle = 7; " ^
157+
"$shortcut.Save()"
158+
if %ERRORLEVEL% EQU 0 (
159+
echo Added 'Chronos Tray' shortcut to your Startup folder.
160+
) else (
161+
echo Warning: Failed to create Startup shortcut automatically.
162+
echo You can still run the tray via tray_launcher.bat.
163+
)
164+
goto tray_startup_done
165+
166+
:tray_startup_no
167+
echo Skipping tray Startup shortcut. You can enable it later by rerunning this script.
168+
169+
:tray_startup_done
170+
exit /b 0

0 commit comments

Comments
 (0)