Skip to content

fix(settings): persist activation mode across restarts - #2

Merged
karamouche merged 1 commit into
gladiaio:mainfrom
hl9020:fix/persist-activation-mode
Aug 4, 2026
Merged

fix(settings): persist activation mode across restarts#2
karamouche merged 1 commit into
gladiaio:mainfrom
hl9020:fix/persist-activation-mode

Conversation

@hl9020

@hl9020 hl9020 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Activation mode is the only setting on the App settings screen that does not survive a restart. Selecting "Toggle", quitting and relaunching brings the app back in "Hold" mode.

The reason is that activationMode only ever existed in React state. There is no field for it in Config, and no save_/get_ command pair, unlike hotkey, languages, endpointing, copy_to_clipboard and audio_device_selection. On every launch the value falls back to the hardcoded push-to-talk default in App.tsx.

Approach

Store it the same way the neighbouring settings are stored, so nothing new is introduced:

  • activation_mode: Option<String> in Config, defaulting to push-to-talk, and covered by fill_defaults so existing config.json files migrate silently.
  • save_activation_mode / get_activation_mode commands, with the setter rejecting anything other than the two valid values.
  • The frontend loads the stored value during init and writes it back from an effect, guarded by a loaded ref exactly like copyToClipboard.

No change to hotkey handling or dictation behaviour - only where the already-existing value is read from and written to.

Testing

Windows 11, installed NSIS build. Set the mode to Toggle, quit, relaunch: the setting is retained and hold-to-talk no longer reactivates. Verified the same for switching back to Hold, and that an existing config.json without the field starts up on the previous default instead of erroring.

  • npm test: 119 Rust tests, 26 vitest tests, typecheck all pass
  • npm run build: clean
  • npm run format: no changes to the files in this PR
  • cargo clippy --all-targets -- -D warnings: fails identically on this branch and on unmodified main (22 pre-existing never used errors on Windows, since much of the accessibility code is macOS-only). No new warnings introduced.

Not verified on macOS - I have no Mac available. The change is platform-independent, but a second pair of eyes there would be welcome.

@karamouche
karamouche self-requested a review August 3, 2026 16:22
@karamouche
karamouche self-requested a review August 3, 2026 20:48

@karamouche karamouche left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, this looks good to me!

One small ask so CI can pass: the commitlint check is failing on body-max-line-length (body lines must be ≤ 100 characters). The subject is fine; it’s the body paragraph that’s too long.

Could you amend/reword the commit message body so each line stays under 100 chars? Thanks

Activation mode lived only in React state: there was no config field
and no save/get command, so every launch fell back to the hardcoded
push-to-talk default. Store it in config.json alongside the other
settings.
@hl9020
hl9020 force-pushed the fix/persist-activation-mode branch from e559137 to 7afc9f8 Compare August 3, 2026 20:53
@hl9020

hl9020 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Good catch, thanks - amended and force-pushed, body lines are now well under 100 characters.

@karamouche
karamouche merged commit 1996501 into gladiaio:main Aug 4, 2026
6 checks passed
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.

2 participants