mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-02-04 15:00:09 +00:00
* Docs * Update docs.yaml * Delete docs/LICENCE * Delete docs/README.md * Update module path in go.mod
85 lines
2.4 KiB
Markdown
85 lines
2.4 KiB
Markdown
# Mouse Acceleration
|
|
|
|
Last Updated: 2024-08-07
|
|
|
|
|
|
> [!NOTE]
|
|
The Development Documentation is auto generated for every compilation of Winutil, meaning a part of it will always stay up-to-date. **Developers do have the ability to add custom content, which won't be updated automatically.**
|
|
## Description
|
|
|
|
If Enabled then Cursor movement is affected by the speed of your physical mouse movements.
|
|
|
|
<!-- BEGIN CUSTOM CONTENT -->
|
|
|
|
<!-- END CUSTOM CONTENT -->
|
|
|
|
<details>
|
|
<summary>Preview Code</summary>
|
|
|
|
```json
|
|
{
|
|
"Content": "Mouse Acceleration",
|
|
"Description": "If Enabled then Cursor movement is affected by the speed of your physical mouse movements.",
|
|
"category": "Customize Preferences",
|
|
"panel": "2",
|
|
"Order": "a107_",
|
|
"Type": "Toggle",
|
|
"link": "https://christitustech.github.io/Winutil/dev/tweaks/Customize-Preferences/MouseAcceleration"
|
|
}
|
|
```
|
|
|
|
</details>
|
|
|
|
## Function: Invoke-WinutilMouseAcceleration
|
|
|
|
```powershell
|
|
Function Invoke-WinutilMouseAcceleration {
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
Enables/Disables Mouse Acceleration
|
|
|
|
.PARAMETER DarkMoveEnabled
|
|
Indicates the current Mouse Acceleration State
|
|
|
|
#>
|
|
Param($MouseAccelerationEnabled)
|
|
try {
|
|
if ($MouseAccelerationEnabled -eq $false) {
|
|
Write-Host "Enabling Mouse Acceleration"
|
|
$MouseSpeed = 1
|
|
$MouseThreshold1 = 6
|
|
$MouseThreshold2 = 10
|
|
} else {
|
|
Write-Host "Disabling Mouse Acceleration"
|
|
$MouseSpeed = 0
|
|
$MouseThreshold1 = 0
|
|
$MouseThreshold2 = 0
|
|
|
|
}
|
|
|
|
$Path = "HKCU:\Control Panel\Mouse"
|
|
Set-ItemProperty -Path $Path -Name MouseSpeed -Value $MouseSpeed
|
|
Set-ItemProperty -Path $Path -Name MouseThreshold1 -Value $MouseThreshold1
|
|
Set-ItemProperty -Path $Path -Name MouseThreshold2 -Value $MouseThreshold2
|
|
} catch [System.Security.SecurityException] {
|
|
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
|
} catch [System.Management.Automation.ItemNotFoundException] {
|
|
Write-Warning $psitem.Exception.ErrorRecord
|
|
} catch {
|
|
Write-Warning "Unable to set $Name due to unhandled exception"
|
|
Write-Warning $psitem.Exception.StackTrace
|
|
}
|
|
}
|
|
|
|
```
|
|
|
|
|
|
<!-- BEGIN SECOND CUSTOM CONTENT -->
|
|
|
|
<!-- END SECOND CUSTOM CONTENT -->
|
|
|
|
|
|
[View the JSON file](https://github.com/ChrisTitusTech/Winutil/tree/main/config/tweaks.json)
|
|
|