Add ToggleMouseSonar and AdjustVolume desktop actions#2201
Merged
TalZaccai merged 1 commit intotalzacc/action_json_schemafrom Apr 16, 2026
Merged
Add ToggleMouseSonar and AdjustVolume desktop actions#2201TalZaccai merged 1 commit intotalzacc/action_json_schemafrom
TalZaccai merged 1 commit intotalzacc/action_json_schemafrom
Conversation
Showcases the two main patterns for adding new actions: Option A - Registry toggle (ToggleMouseSonar): One line in MouseSettingsHandler constructor using AddRegistryToggleAction. No custom handler logic needed. Option B - Typed action with logic (AdjustVolume): TS schema type + C# handler with relative volume adjustment, clamping, and saved-volume tracking. Includes unit tests for both actions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Collaborator
|
for the registry toggle action, once you set the value does it immediately take effect or do we need to broadcast some sort of WM_SETTINGCHANGED for it to work first? |
Collaborator
|
BTW, 😍 |
Contributor
Author
It does not take affect immediately, but this might be a wider fix than just this specific toggle, I'll look into fixing it in a separate PR. |
Collaborator
|
Might be this: WM_SETTINGCHANGE message (Winuser.h) - Win32 apps | Microsoft Learn<https://learn.microsoft.com/en-us/windows/win32/winmsg/wm-settingchange>
…________________________________
From: Tal Zaccai ***@***.***>
Sent: Wednesday, April 15, 2026 11:27 PM
To: microsoft/TypeAgent ***@***.***>
Cc: Robert Gruen ***@***.***>; Comment ***@***.***>
Subject: Re: [microsoft/TypeAgent] Add ToggleMouseSonar and AdjustVolume desktop actions (PR #2201)
[https://avatars.githubusercontent.com/u/18443527?s=20&v=4]TalZaccai left a comment (microsoft/TypeAgent#2201)<#2201?email_source=notifications&email_token=AGBS6WN6M2DK7KADDEZHPV34WB4ONA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMRVG44DANRYGA4KM4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJNLQOJPWG33NNVSW45C7N5YGK3S7MNWGSY3L#issuecomment-4257806808>
for the registry toggle action, once you set the value does it immediately take effect or do we need to broadcast some sort of WM_SETTINGCHANGED for it to work first?
It does not take affect immediately, but this might be a wider fix than just this specific toggle, I'll look into fixing it in a separate PR.
—
Reply to this email directly, view it on GitHub<#2201?email_source=notifications&email_token=AGBS6WN6M2DK7KADDEZHPV34WB4ONA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMRVG44DANRYGA4KM4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJNLQOJPWG33NNVSW45C7N5YGK3S7MNWGSY3L#issuecomment-4257806808>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGBS6WN676GFGEEOSHTFWWD4WB4ONAVCNFSM6AAAAACX24BOTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DENJXHAYDMOBQHA>.
You are receiving this because you commented.Message ID: ***@***.***>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This branch (based on
talzacc/action_json_schema) demonstrates how easy it is to add new actions after the architecture refactoring in #2196. Two new actions are added, showcasing the two main patterns described in the README.ToggleMouseSonar — Option A: Registry Toggle
Enables/disables the Windows "Find my pointer" ring that appears when pressing Ctrl.
Total lines added: 1 (in
MouseSettingsHandler.cs)No custom handler logic. The
AddRegistryToggleActionhelper does everything — reads theenableparameter, writes the registry value, returns anActionResult.AdjustVolume — Option B: Typed Action with Custom Logic
Adjusts volume relatively ("turn it up a bit") instead of setting an absolute value.
Steps:
actionsSchema.tsAudioActionHandler.cs— reads current volume, applies delta, clamps 0–100, saves for restoreThe C#
AdjustVolumeParamsrecord is automatically generated by the Roslyn source generator from the.pas.jsonschema — no manual C# type definition needed.Test Coverage
AdjustVolume(up/down, default amount, clamping, volume save)ToggleMouseSonar(enable/disable registry writes)