PowerToys icon indicating copy to clipboard operation
PowerToys copied to clipboard

feat(MouseWithoutBorders): Prevent Easy Mouse from moving to another machine when an application is running in fullscreen mode.

Open dot-tb opened this issue 6 months ago • 7 comments

Summary of the Pull Request

This PR adds a new feature to Easy Mouse, it is now possible to toggle a setting that will prevent Easy Mouse to switch away from the host machine when the foreground application is running in full screen mode, requiring the user to first alt tab out of the application before performing the switch, this also comes with a way to allow the switch on specific apps.

image

PR Checklist

  • [x] Closes: #32197
  • [x] Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • [ ] Tests: Added/updated and all pass
  • [x] Localization: All end user facing strings can be localized
  • [ ] Dev docs: Added/updated
  • [ ] New binaries: Added on the required places
  • [x] Documentation updated: If checked, please file a pull request on our docs repo and link it here: MicrosoftDocs/windows-dev-docs#5470

Detailed Description of the Pull Request / Additional comments

This PR changes the way Easy Mouse checks wherever it should move to another machine, after checking that the corresponding setting is enabled and that we are trying to move away from the host machine, it will run a test using native WinAPI methods to get the foreground window and check if it is running in full screen.

If it is, it will then check the name of the executable against a list of ignored app configured by the user, if the executable is found in that list, the switch will be allowed despite the application running in full screen.

These new settings were moved along with the original Easy Mouse toggle to a new "Easy Mouse" setting group to avoid cluttering the Keyboard shortcuts group.

This feature will only work when used from the controller machine, as I didn't find a way to easily check for running application on a remote machine that didn't involved touching the sockets, I felt like such a change would be out of scope for this issue.

Validation Steps Performed

I had a hard time writing tests and didn't achieve anything meaningful enough to be included, I may require some guidance on how to properly write tests for this project.

I tested my changes by running my modified version of MouseWithoutBorders on my machines, which I did for a few days now, It allowed me to catch a few bugs, but it has been running smoothly otherwise.

My changes didn't seemed to have caused any automated tests to fail.

It may require some additional testing for setups including more than two machines.

dot-tb avatar Jun 02 '25 11:06 dot-tb

@microsoft-github-policy-service agree

dot-tb avatar Jun 02 '25 11:06 dot-tb

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

Unrecognized words (1)

DWFLAGS

These words are not needed and should be removed DEFT iextn localappdata pswd SHELLEXTENSION SHELLNEWVALUE SHGFIICON SHGFILARGEICON

Some files were automatically ignored :see_no_evil:

These sample patterns would exclude them:

^\Q.pipelines/272MSSharedLibSN2048.snk\E$

You should consider adding them to:

.github/actions/spell-check/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept these unrecognized words as correct, update file exclusions, and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the [email protected]:dot-tb/PowerToys.git repository on the mouse-without-borders/stop-easy-mouse-when-foreground-fullscreen branch (:information_source: how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/67debf50669c7fc76fc8f5d7f996384535a72b77/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/15416238520/attempts/1'

Errors (3)

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

:x: Errors Count
:warning: binary-file 1
:x: ignored-expect-variant 2
:warning: no-newline-at-eof 1

See :x: Event descriptions for more information.

If the flagged items are :exploding_head: false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

github-actions[bot] avatar Jun 03 '25 11:06 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

Unrecognized words (1)

DWFLAGS

These words are not needed and should be removed DEFT iextn localappdata pswd SHELLEXTENSION SHELLNEWVALUE SHGFIICON SHGFILARGEICON

Some files were automatically ignored :see_no_evil:

These sample patterns would exclude them:

^\Q.pipelines/272MSSharedLibSN2048.snk\E$

You should consider adding them to:

.github/actions/spell-check/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept these unrecognized words as correct, update file exclusions, and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the [email protected]:dot-tb/PowerToys.git repository on the mouse-without-borders/stop-easy-mouse-when-foreground-fullscreen branch (:information_source: how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/67debf50669c7fc76fc8f5d7f996384535a72b77/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/15426104366/attempts/1'

Errors (3)

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

:x: Errors Count
:warning: binary-file 1
:x: ignored-expect-variant 2
:warning: no-newline-at-eof 1

See :x: Event descriptions for more information.

If the flagged items are :exploding_head: false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

github-actions[bot] avatar Jun 03 '25 19:06 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

Unrecognized words (1)

DWFLAGS

These words are not needed and should be removed DEFT iextn localappdata pswd SHELLEXTENSION SHELLNEWVALUE SHGFIICON SHGFILARGEICON

Some files were automatically ignored :see_no_evil:

These sample patterns would exclude them:

^\Q.pipelines/272MSSharedLibSN2048.snk\E$

You should consider adding them to:

.github/actions/spell-check/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept these unrecognized words as correct, update file exclusions, and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the [email protected]:dot-tb/PowerToys.git repository on the mouse-without-borders/stop-easy-mouse-when-foreground-fullscreen branch (:information_source: how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/67debf50669c7fc76fc8f5d7f996384535a72b77/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/15426254704/attempts/1'

Errors (3)

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

:x: Errors Count
:warning: binary-file 1
:x: ignored-expect-variant 2
:warning: no-newline-at-eof 1

See :x: Event descriptions for more information.

If the flagged items are :exploding_head: false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

github-actions[bot] avatar Jun 03 '25 19:06 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

Unrecognized words (1)

GC'd

These words are not needed and should be removed DEFT iextn localappdata msvsmon OTHERUNZOOM OTHERZOOM PARENTCLOSING PARENTOPENING pswd SCROLLCHILDREN SHELLEXTENSION SHELLNEWVALUE SHGFIICON SHGFILARGEICON TGM VARENUM

Some files were automatically ignored :see_no_evil:

These sample patterns would exclude them:

^\Q.pipelines/272MSSharedLibSN2048.snk\E$
^src/modules/ZoomIt/ZoomIt/ZoomIt\.idc$

You should consider adding them to:

.github/actions/spell-check/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept these unrecognized words as correct, update file exclusions, and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the [email protected]:dot-tb/PowerToys.git repository on the mouse-without-borders/stop-easy-mouse-when-foreground-fullscreen branch (:information_source: how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/c635c2f3f714eec2fcf27b643a1919b9a811ef2e/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/15557032023/attempts/1' &&
git commit -m 'Update check-spelling metadata'
Warnings :warning: (4)

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

:warning: Warnings Count
:warning: binary-file 1
:warning: ignored-expect-variant 2
:warning: no-newline-at-eof 2
:warning: single-line-file 1

See :warning: Event descriptions for more information.

If the flagged items are :exploding_head: false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

github-actions[bot] avatar Jun 10 '25 10:06 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

Unrecognized words (1)

GC'd

These words are not needed and should be removed DEFT iextn localappdata msvsmon OTHERUNZOOM OTHERZOOM PARENTCLOSING PARENTOPENING pswd SCROLLCHILDREN SHELLEXTENSION SHELLNEWVALUE SHGFIICON SHGFILARGEICON TGM VARENUM

Some files were automatically ignored :see_no_evil:

These sample patterns would exclude them:

^\Q.pipelines/272MSSharedLibSN2048.snk\E$
^src/modules/ZoomIt/ZoomIt/ZoomIt\.idc$

You should consider adding them to:

.github/actions/spell-check/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept these unrecognized words as correct, update file exclusions, and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the [email protected]:dot-tb/PowerToys.git repository on the mouse-without-borders/stop-easy-mouse-when-foreground-fullscreen branch (:information_source: how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/c635c2f3f714eec2fcf27b643a1919b9a811ef2e/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/15557211513/attempts/1' &&
git commit -m 'Update check-spelling metadata'
Warnings :warning: (4)

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

:warning: Warnings Count
:warning: binary-file 1
:warning: ignored-expect-variant 2
:warning: no-newline-at-eof 2
:warning: single-line-file 1

See :warning: Event descriptions for more information.

If the flagged items are :exploding_head: false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it, try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

github-actions[bot] avatar Jun 10 '25 10:06 github-actions[bot]

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

Unrecognized words (1)

GC'd These words are not needed and should be removed

Some files were automatically ignored 🙈

To accept these unrecognized words as correct, update file exclusions, and remove the previously acknowledged and now absent words, you could run the following commands

Warnings ⚠️ (4)

See the 📂 files view, the 📜action log, or 📝 job summary for details.

⚠️ Warnings Count ⚠️ binary-file 1 ⚠️ ignored-expect-variant 2 ⚠️ no-newline-at-eof 2 ⚠️ single-line-file 1

See ⚠️ Event descriptions for more information. If the flagged items are 🤯 false positives

This wasn't added by my PR.

dot-tb avatar Jun 10 '25 10:06 dot-tb

Thanks for this, Let's target this pr into 93 release ❤️

vanzue avatar Jun 17 '25 06:06 vanzue

Thanks for this, Let's target this pr into 93 release ❤️

Should I keep this PR up to date with the main branch ?

dot-tb avatar Jun 17 '25 10:06 dot-tb

I don't think you have to, let's do once before check in 🙂

vanzue avatar Jun 17 '25 11:06 vanzue

@niels9001 @cinnamon-msft Do you have any feedback on the settings wording and design?

vanzue avatar Jul 21 '25 07:07 vanzue

Is "Easy Mouse" a product / feature name? Assuming yes, I've made some recommendations on strings

Easy Mouse is indeed the name that was given to the feature allowing Mouse Without Borders to switch between machines when the mouse reaches the edge of the screen.

I added the suggested changes to the PR.

dot-tb avatar Jul 22 '25 15:07 dot-tb

/azp run

yeelam-gordon avatar Aug 22 '25 01:08 yeelam-gordon

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Aug 22 '25 01:08 azure-pipelines[bot]

/azp run

yeelam-gordon avatar Aug 22 '25 02:08 yeelam-gordon

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Aug 22 '25 02:08 azure-pipelines[bot]

It seems like this feature is enabled by default, which is causing some confusion for users upgrading to the latest version of PowerToys. ( As seen in some new issues concerning MWB ) Could it be possible to do anything about that now ?

dot-tb avatar Sep 13 '25 21:09 dot-tb