Skip to content

Instantly share code, notes, and snippets.

@fritschy
Last active January 25, 2019 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fritschy/5439abe2c2d85347503211848baa2d0f to your computer and use it in GitHub Desktop.
Save fritschy/5439abe2c2d85347503211848baa2d0f to your computer and use it in GitHub Desktop.
Focus Follows Mouse for Windows 10
# According to: https://superuser.com/a/1209478/60220
$sinature = @"
[DllImport("user32.dll")]
public static extern bool SystemParametersInfo(int uAction, int uParam, ref
int lpvParam, int flags );
"@
$systemParamInfo = Add-Type -memberDefinition $signature -Name SloppyFocusMouse -passThru
[Int32]$newVal = 1
$systemParamInfo::SystemParametersInfo(0x1001, 0, [REF]$newVal, 2)
from ctypes import *
SPI_SETACTIVEWINDOWTRACKING = c_uint(0x1001)
dll = WinDLL('user32')
if dll.SystemParametersInfoA(SPI_SETACTIVEWINDOWTRACKING,c_uint(0),pointer(c_uint(1)),c_uint(2)):
print("Enabled focus-follows-mouse")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment