Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

dot-tb
Copy link

@dot-tb dot-tb commented Jun 2, 2025

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

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 added 10 commits May 26, 2025 22:45
…dow is fullscreen:

MouseWithoutBorders/App/Core/Event.cs:
    - Renamed switchByMouseEnabled to isEasySwitchAllowed as it will now take into account if the foreground window is fullscreen when trying to switch.

MouseWithoutBorders/App/Class/Common.cs:
    - New IsForegroundWindowFullscreen function to check if the current foreground window of the controller machine is in fullscreen.
    - Moved Easy Mouse settings to a new setting group.
    - Added an option to disable easy mouse when an app is running in fullscreen mode.
    - Added textbox to add processes that will not disable easy mouse when they are in fullscreen.
    - Changed easy mouse fullscreen ignored app to a list of string using the GenericProperty<List<string>> Type.

    - Removed spell checking from the ignored app text box.
    - Changed default value hack for the EasyMouseFullscreenSwitchBlockExcludedApps and removed the JsonPropertyName.
    - Renamed IsForegroundWindowFullscreen to IsEasyMouseBlockedByFullscreenWindow, function is now checking if the fullscreen process is in the exclusion list.
    - Easy Mouse will check if we need to move machine before checking for fullscreen app.
    - Changed EasyMouseFullscreenSwitchBlockExcludedApps property to HashSet.
    - Added EasyMouseFullscreenSwitchBlockExcludedApps to MouseWithoutBorders Settings.cs
    - Added QueryFullProcessImageName in NativeMethods.cs
…-borders/stop-easy-mouse-when-foreground-fullscreen
    - Fixed a bug that wouldn't let the mouse return to the controller machine when a fullscreen app was running on it.
- Moved functions out of the Event.cs.
- Added info card to warn that this feature will only work on the host machine.
@dot-tb dot-tb changed the title Mouse without borders/stop easy mouse when foreground fullscreen feat(MouseWithoutBorders) : Disable easy mouse when foreground fullscreen Jun 2, 2025
@dot-tb
Copy link
Author

dot-tb commented Jun 2, 2025

@microsoft-github-policy-service agree

@dot-tb dot-tb changed the title feat(MouseWithoutBorders) : Disable easy mouse when foreground fullscreen feat(MouseWithoutBorders): Setting to prevent Easy Mouse from switching to another machine when an application is running in fullscreen mode. Jun 2, 2025
@dot-tb dot-tb changed the title feat(MouseWithoutBorders): Setting to prevent Easy Mouse from switching to another machine when an application is running in fullscreen mode. feat(MouseWithoutBorders): Prevent Easy Mouse from moving to another machine when an application is running in fullscreen mode. Jun 2, 2025
dot-tb added 4 commits June 2, 2025 19:47
- Fixed a bug that would prevent moving away from a remote machine if we were moving to another remote machine.
- Rephrasing some confusing text
- Fixed some typos
- Check that the setting is enabled before checking if we are on the host machine
@dot-tb dot-tb marked this pull request as ready for review June 2, 2025 22:12
@dot-tb dot-tb marked this pull request as draft June 3, 2025 10:09
- Fixed comparing the windowsShellHandle to itself instead of the desktop handle.
- If both the height and width of the foreground window are bigger than the screen, consider it full screen.

This comment has been minimized.

- Changed DWFLAGS to FLAGS in NativeMethods dwFlags enums.

This comment has been minimized.

This comment has been minimized.

- Fixed allowing machine switch when fullscreen app were not the exact size of the screen.
- Moved away from testing screen boundaries to detect full screen app, now checking user notification state.
@dot-tb dot-tb force-pushed the mouse-without-borders/stop-easy-mouse-when-foreground-fullscreen branch from 0a8de95 to 046f157 Compare June 3, 2025 19:44
- Added checks and debug logs for failure in some WinAPI native functions.
@dot-tb dot-tb marked this pull request as ready for review June 3, 2025 20:59
- Fixed a check where the wrong operator was used.
@dot-tb dot-tb marked this pull request as draft June 4, 2025 15:31
@dot-tb dot-tb marked this pull request as ready for review June 4, 2025 22:16
@vanzue vanzue self-requested a review June 5, 2025 01:50
@yeelam-gordon yeelam-gordon requested a review from Copilot June 10, 2025 04:46
@yeelam-gordon yeelam-gordon added the Product-Mouse Without Borders Refers to the Mouse Without Borders module label Jun 10, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a toggle and exclusion list to prevent Easy Mouse from switching machines when a fullscreen application is active.

  • Introduces two new settings: disabling Easy Mouse on fullscreen and a per-app exclusion list.
  • Updates ViewModel, UI (XAML), and settings properties to surface the new controls.
  • Implements native WinAPI calls to detect fullscreen apps and block switches accordingly.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs Adds properties to bind fullscreen‐block toggle and exclusion list.
src/settings-ui/Settings.UI/Strings/en-us/Resources.resw Adds new resource strings for the fullscreen toggle and expander.
src/settings-ui/Settings.UI/SettingsXAML/Views/MouseWithoutBordersPage.xaml Inserts UI controls (ToggleSwitch, InfoBar, Expander) for the new feature.
src/settings-ui/Settings.UI.Library/MouseWithoutBordersProperties.cs Defines new properties and default values for the fullscreen settings.
src/modules/MouseWithoutBorders/App/Core/Event.cs Integrates fullscreen-check logic into mouse‐move event handler.
src/modules/MouseWithoutBorders/App/Class/Setting.cs Exposes internal getters/setters for the new settings.
src/modules/MouseWithoutBorders/App/Class/NativeMethods.cs Adds P/Invoke declarations and enums for fullscreen detection.
src/modules/MouseWithoutBorders/App/Class/Common.cs Implements logic to detect blocked fullscreen apps and overall switch allowance.
Comments suppressed due to low confidence (4)

src/modules/MouseWithoutBorders/App/Core/Common.cs:1620

  • This new fullscreen‐blocking logic lacks unit or integration tests. Consider adding tests for various window states and exclusion list behavior.
internal static bool IsEasyMouseSwitchAllowed()

src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs:1016

  • [nitpick] Property name 'EasyMouseEnabledAndDisableOnFullscreen' is confusing. Consider renaming to something like 'IsEasyMouseBlockingOnFullscreenEnabled' for clarity.
public bool EasyMouseEnabledAndDisableOnFullscreen =>

src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs:908

  • Assigning an array literal to a HashSet property will not compile. Consider converting the split values into a HashSet, e.g., new HashSet(value.Split('\r')).
Settings.Properties.EasyMouseFullscreenSwitchBlockExcludedApps.Value = value == string.Empty ? [] : [..value.Split('\r')];

src/settings-ui/Settings.UI.Library/MouseWithoutBordersProperties.cs:185

  • Initializing a GenericProperty<HashSet> with [] produces a string[] rather than a HashSet. Use new GenericProperty<HashSet>(new HashSet()) instead.
EasyMouseFullscreenSwitchBlockExcludedApps = new GenericProperty<HashSet<string>>([]);

dot-tb and others added 3 commits June 10, 2025 12:24
…dersPage.xaml


Removed typo suggested by Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Fixed typo suggested by Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Removed unused import.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

This comment has been minimized.

- Renamed ui binded variable EasyMouseEnabledAndDisableOnFullscreen to IsEasyMouseBlockingOnFullscreenEnabled as suggested by copilot.
Copy link

@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 DEFT iextn localappdata msvsmon OTHERUNZOOM OTHERZOOM PARENTCLOSING PARENTOPENING pswd SCROLLCHILDREN SHELLEXTENSION SHELLNEWVALUE SHGFIICON SHGFILARGEICON TGM VARENUM

Some files were automatically ignored 🙈

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 git@github.com:dot-tb/PowerToys.git repository
on the mouse-without-borders/stop-easy-mouse-when-foreground-fullscreen branch (ℹ️ 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 ⚠️ (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

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.

@dot-tb
Copy link
Author

dot-tb commented Jun 10, 2025

@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.

@vanzue vanzue added this to the PowerToys 0.93 milestone Jun 17, 2025
@vanzue
Copy link
Contributor

vanzue commented Jun 17, 2025

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

@dot-tb
Copy link
Author

dot-tb commented Jun 17, 2025

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

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

@vanzue
Copy link
Contributor

vanzue commented Jun 17, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Product-Mouse Without Borders Refers to the Mouse Without Borders module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants