microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
108.11k stars 6.38k forks source link

MouseWithoutBorders and AutoHotKey #26483

Open SharpRT opened 1 year ago

SharpRT commented 1 year ago

Microsoft PowerToys version

0.70.0

Installation method

PowerToys auto-update

Running as admin

None

Area(s) with issue?

Mouse Without Borders

Steps to reproduce

With the Microsoft Garage version of MWB, whenever I switch to the remote device, the active window on the host/now inactive device changes to a MWB specific window. This allows me to suspend various AHK scripts when the device is no longer active. I could identify when the device became inactive by checking when the MWB specific window identified by 'ahk_class WindowsForms10.Window.8.app.0.141b42a_r6_ad1' or 'ahk_exe MousewithoutBordersHelper.exe' became active. This is what would appear on the inactive device when using AHK's Window Spy.

Using the PowerToys version of MWB, whenever I move to a remote device, the active window now becomes whatever is in the location of where the mouse sleeps (at the top centre if 'Hide mouse at the screen edge' is selected; or the centre, otherwise). So e.g. if I have Excel open on my inactive device, that will be the window that is classed as active.

Is there any possibility of having the old behaviour back? So that the active window becomes a MWB specific value?

I would prefer to stick with the PowerToys version as I assume this will be the version that will be getting updated going forward.

✔️ Expected Behavior

An MWB specific value to be returned when querying the active window on the inactive device in AHK.

❌ Actual Behavior

The top window is identified as being the active window on the inactive device in AHK.

Other Software

AutoHotKey v2.0.2

dtaylor84 commented 1 year ago

Might be fixed by #26524?

SharpRT commented 1 year ago

This is now fixed in 0.70.1.

SharpRT commented 1 year ago

Or partially fixed! The behaviour occasionally reappears. Turning off and on MWB from PowerToys settings fixes the issue. I will update if I manage to narrow down the conditions that cause it.

SharpRT commented 1 year ago

Pressing Ctrl+Alt+Del reintroduces the incorrect behaviour.

komazhou commented 11 months ago

Microsoft PowerToys version

0.70.0

Installation method

PowerToys auto-update

Running as admin

None

Area(s) with issue?

Mouse Without Borders

Steps to reproduce

With the Microsoft Garage version of MWB, whenever I switch to the remote device, the active window on the host/now inactive device changes to a MWB specific window. This allows me to suspend various AHK scripts when the device is no longer active. I could identify when the device became inactive by checking when the MWB specific window identified by 'ahk_class WindowsForms10.Window.8.app.0.141b42a_r6_ad1' or 'ahk_exe MousewithoutBordersHelper.exe' became active. This is what would appear on the inactive device when using AHK's Window Spy.

Using the PowerToys version of MWB, whenever I move to a remote device, the active window now becomes whatever is in the location of where the mouse sleeps (at the top centre if 'Hide mouse at the screen edge' is selected; or the centre, otherwise). So e.g. if I have Excel open on my inactive device, that will be the window that is classed as active.

Is there any possibility of having the old behaviour back? So that the active window becomes a MWB specific value?

I would prefer to stick with the PowerToys version as I assume this will be the version that will be getting updated going forward.

✔️ Expected Behavior

An MWB specific value to be returned when querying the active window on the inactive device in AHK.

❌ Actual Behavior

The top window is identified as being the active window on the inactive device in AHK.

Other Software

AutoHotKey v2.0.2

How to suspend various AHK scripts when the device is no longer active? Can you share your code?

SharpRT commented 11 months ago

I believe this snippet captures everything you need.


While true {    

    WinWaitActive("ahk_exe PowerToys.MousewithoutBordersHelper.exe")
    Suspend True

    WinWaitNotActive("ahk_exe PowerToys.MousewithoutBordersHelper.exe")
    Suspend False
}