Repository navigation
[Mouse Utilities] Add Auto Hide Cursor - #50271
Gleb Khmyznikov (khmyznikov) merged 7 commits into
Conversation
Add global hide-on-typing and idle-timeout behavior with supervised cursor restoration, Settings integration, policy support, telemetry, signing, and focused tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Thank you for contributing to PowerToys. We've detected that this PR might include a new or modified telemetry event. After this PR is merged, please follow these next steps:
|
✅ PR intakeAll automated intake checks now pass. Thanks for the updates! Automated PR intake; PowerToys maintainers make final decisions. |
|
Damian Edwards (@DamianEdwards) mouse utils now has actual UI Tests. Please make sure your new moduled covered by that as well. https://github.com/microsoft/PowerToys/tree/main/src/modules/MouseUtils/MouseUtils.UITests.Next You can use skills |
Cover settings navigation, module lifecycle, independent triggers, worker behavior, idle-delay enablement, boundary values, and persistence. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Added three
The tests include failure-safe cleanup that disables the module and reloads the system cursors. The x64 Debug UI-test project builds successfully and all three tests are discovered by Microsoft.Testing.Platform. Full VM execution is currently blocked because this host has no configured local UI-test VM root ( |
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Damian Edwards (@DamianEdwards) check tests failures. https://dev.azure.com/shine-oss/PowerToys/_build/results?buildId=388022&view=results If you have a hyper-v on your machine, you can use the |
Use the foreground-safe physical click path for the display-only SettingsExpander automation peer instead of unsupported UIA Invoke. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Diagnosed all six failures from build Fixed in Validated the fix with the trusted local Hyper-V workflow on
The x64 Debug product and test projects built successfully. The VM run used the repository-pinned winappcli v0.3.2 and a private .NET 10.0.11 desktop runtime. Durable result: |
|
Verified the Auto Hide Cursor UI tests locally with the repository's Hyper-V UI-test VM harness against PR head Guest: Windows 11 Pro
Evidence/run ID: |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Damian Edwards (@DamianEdwards) one test remain flaky? |
Use absolute SendInput coordinates for Spotlight cursor tracking so the UI test still exercises the low-level mouse hook without depending on Windows pointer acceleration. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
I investigated this as a possible Auto Hide Cursor ordering/state leak. Before changing the test, the suspect Spotlight test passed 10/10 on this PR and 10/10 on clean The Windows 10 failure showed the real flaw: two nominally identical relative |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
1 similar comment
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
|
Damian Edwards (@DamianEdwards) still an error on Win10: failed SpotlightModeUsesAlwaysColorAndRadius (7s 740ms) Standard output |
Remove the absolute SendInput helper that Windows 10 CI accepted without moving the cursor. Keep the proven relative-input hook path, capture the pre-activation desktop, and validate Spotlight at the actual accelerated endpoint. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The absolute Local Hyper-V validation on Windows 11 Pro 10.0.26200.0 x64: Spotlight 20/20 consecutive passes; five ordered Auto Hide Cursor → all Mouse Highlighter sequences passed 60/60 ( |
|
Verified the full unfiltered |
Describe the module enablement event and its Enabled boolean in the diagnostic data inventory. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Gleb Khmyznikov (khmyznikov)
left a comment
There was a problem hiding this comment.
Requesting changes for two issues: the native module has an incorrect interface include that blocks compilation, and the worker can indefinitely postpone idle hiding while receiving ignored injected mouse input. Details and suggested fixes are inline. Findings are based on source inspection of commit c631c4d.
Evaluate the physical idle deadline after every message wake and bound dispatch batches while retaining stop-handle priority. Cover repeated injected mouse input, a busy posted-message queue, and disable/restoration through the real worker in UI tests. Correct the module-interface relative include path. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
f47af41
into
microsoft:main
Port the legacy MouseButtonLockTests to the .Next suite, following the Auto Hide Cursor tests from microsoft#50271, and remove the legacy copy and its now-unused helper constants. The new tests assert effects rather than control round-trips: the options expander follows the module toggle, the lock checkboxes and the hold duration and move-cancel boundary values persist to settings.json and survive a restart, and a held button actually locks past the configured duration, releases on a same-button tap, and does not lock under the threshold or when its lock is disabled. Lock state is read with GetAsyncKeyState, since the module runs inside the runner with no worker process or named event to observe. The gestures use the left and middle buttons so an unlocked release never opens a context menu, and enable/disable checks retry until the runner has applied the toggle. Add AutomationIds for the module toggle and the three lock checkboxes, and record the coverage in the migration checklist.
|
Damian Edwards (@DamianEdwards) hey dude, Just out of curiosity, why is this feature useful? |
|
Felipe A. Braga (@felipebraga) some folks (like me) prefer to use a larger mouse pointer setting to make it easier to see/find, but it means when clicking on a text box and then typing the cursor itself can obscure what's in the text box as you type. Windows has a native feature that auto-hides the cursor when typing in a text box but it only works for certain controls and doesn't include web-based UI. |
|
Damian Edwards (@DamianEdwards) Oh, got what you mean, and yes, it's useful. Thanks for your reply and explanation. |
Summary of the Pull Request
Fixes #11566
Adds a disabled-by-default Auto Hide Cursor utility under Mouse Utilities. Users can independently hide the pointer after keyboard input, after 1–60 seconds of pointer inactivity, or enable both triggers. Injected input and modifier-only key presses are ignored, and a small movement threshold filters pointer noise. Genuine pointer movement, mouse buttons, and wheel input restore the cursor.
The implementation runs low-level input hooks in a supervised Per-Monitor V2 worker. It temporarily replaces standard system cursor shapes and reloads the configured cursor scheme on disable, shutdown, or a worker/Runner failure. It does not use the
ShowCursorcounter or modify the registry cursor scheme.Known limitation: applications that render fully custom or software cursors may remain visible.
PR Checklist
PowerToys.slnxDetailed Description of the Pull Request / Additional comments
Settings, serialization, module enablement, GPO policy, telemetry, Quick Access metadata, Runner discovery, solution wiring, localization, and signing are included. If neither trigger is selected, the module installs no hooks and does not hide the cursor.
The module supervises the worker process and restores cursors if it exits unexpectedly. The worker watches the Runner and performs the same restoration if the Runner exits. This avoids leaving the cursor scheme replaced after a single-process failure.
Validation Steps Performed
The validation host does not have Spectre-mitigated libraries installed, so local builds used
/p:SpectreMitigation=false.Screenshot