Skip to content

feat: Add 'Run on Start' option#8

Merged
bearice merged 3 commits intomasterfrom
refactor/run-on-start-menu
May 23, 2025
Merged

feat: Add 'Run on Start' option#8
bearice merged 3 commits intomasterfrom
refactor/run-on-start-menu

Conversation

@bearice
Copy link
Owner

@bearice bearice commented May 22, 2025

This commit introduces an option to make the application run on Windows startup.

The changes include:

  • Added a 'ToggleRunOnStart' event.
  • Added a checkable "Run on Start" item to the tray icon menu.
  • Implemented is_run_on_start_enabled() to check the registry for the autostart setting (HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run - "RustCat").
  • Implemented set_run_on_start(enable: bool) to add or remove the "RustCat" value from the startup registry key. This function also retrieves the current executable path.
  • The event loop now handles ToggleRunOnStart to call set_run_on_start and updates the menu item's check state.
  • The initial state of the "Run on Start" menu item is set correctly when the application starts and when the menu is rebuilt (e.g., after theme/icon changes).

google-labs-jules bot and others added 3 commits May 22, 2025 06:14
This commit refactors the `build_menu` function to encapsulate the logic for determining the "Run on Start" menu item's checked state.

Changes:
- `build_menu` no longer accepts `run_on_start_enabled` as a parameter.
- Instead, `build_menu` now calls `is_run_on_start_enabled()` internally to get the current state.
- Call sites for `build_menu` (in `main` function, `update_icon` closure, and the `ToggleRunOnStart` event handler) have been updated to reflect the new function signature.

This improves code clarity by making `build_menu` self-contained regarding the "Run on Start" state and simplifies its usage. I made this change based on your feedback to improve the previous implementation.
Updates actions/checkout, actions/cache, and actions/upload-artifact
to newer versions (v4) to resolve an issue with "Missing download info"
for actions/cache@v2 and to use more current, supported action versions.

- Changed actions/checkout@v2 to actions/checkout@v4
- Changed actions/cache@v2 to actions/cache@v4
- Changed actions/upload-artifact@master to actions/upload-artifact@v4
@bearice bearice merged commit 3a615d7 into master May 23, 2025
1 check passed
@bearice bearice deleted the refactor/run-on-start-menu branch July 9, 2025 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant