Skip to content

Powershell function to allow changing mouse cursor attributes in Windows 10

Notifications You must be signed in to change notification settings

ajw107/PS_Set-Mouse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

PS_Set-Mouse

Powershell function to allow changing mouse cursor attributes in Windows 10.

Description

Sets the mouse speed, cursor scheme, mouse trails, scroll lines and sonar (helps to fins the pointer on pressing the ctrl key) via the SystemParametersInfo and stores the values in the registry. Note: Still very much a work in progress (look at the todo list), but most things work

Parameters

-Speed

An integer between 1 (slowest) and 20 (fastest).

-ScrollLines

An integer between -1 (slowest) and 100 (fastest).

-MouseTrailsOn

Turns on Mouse Trails

-MouseTrailsLength

An integer between 2 (shortest) and 15 (longest) for length of the trail (in number of cursosrs to see)

-MouseSonarOn

Turns on Mouse Sonar (so you can find the cursor by pressing the ctrl key)

-CursorScheme

The name of the Cursor Scheme to use (validated against default windows schemes listed in registry, tab-completion supported)

-CursorSize

An integer between 1 (smallest) and 15 (largest) representing the cursor size to use NOTE: Not working YET

Examples

Sets the mouse speed to the value 10.

PS C:> Set-Mouse -Speed 10

Sets the mouse WheelScrollLines to the value 5.

PS C:> Set-Mouse -ScrollLines 5

Turn on Mouse Trails and set them to longest

PS C:> `Set-Mouse -MouseTrailsOn -MouseTrailsLength 15

Turn on the Mouse Sonar feature (find cursor by tapping ctrl key)

PS C:> `Set-Mouse -MouseSonarOn

References

TODO

  • Investigate UserPreferences more
  • Add -SonarOff and -TrailsOff switches
  • Add more examples
  • Allow choosing User Defined Cursor Schemes (scheme source other than 0)
  • -ScrollLines doesn't appear to work until you change windows, display a warning
  • Add authour information, etc
  • For gods sake, COMMENT YOUR CODE!!!!
  • Do something with the Get-Mouse function
  • Stop the system call displaying True/False (either | Out-Null or check it and do error handling). Although be aware that calling SPI_SETCURSOR with both SendChange and UpdateIniFile set will return false but still work (well apart from the cursor size). Selecting only one of them will return true, so not holding out for much there.
  • Why won't -CursorSize work?
    • Just noticed, cursors set using Ease of Access in Settings actually have a _eoa suffix and are in %LocalAppData%\Microsoft\Windows\Cursors instead of %WinDir%\Cursors, they also have modified times of only a few hours ago. Could they be dynamically generated by Ease of Access when you select the size (it would explain the delay)
    • Add -UseEOACursors option to use the _eoa.cur files. No handy registry entry with a list of these files though, so you will have to manually create a seperate CURSOR_NAMES array (has more cursors) and hard-code the filename (they are in %LocalAppData%\Microsoft\Windows\Cursors)
  • Find a way to not hard-code the CURSOR_NAMES array
  • When writing pairs to registry in -CursorScheme, do a check to make sure the two arrays are the same size. I'm not doing it now just for ease of debugging surprisingly
  • Change the number of elements to remove from the end of the initial SchemeFiles array to a constant
  • Create an option to set Text Indicator:
    • Reg Location: HKEY_CURRENT_USER\SOFTWARE\Microsoft\Accessibility\CursorIndicator
    • Set Colour Key: IndicatorColor (RGB Hex nice purple is 0xff00bf)
    • Set size Key: IndicatorType (an int 1-5)
  • Create a Set-Font function to set windows font sizes and weights for Window Titles, Status Bars, Menus, Icons, Messages, etc

About

Powershell function to allow changing mouse cursor attributes in Windows 10

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published