Created
October 31, 2024 02:15
-
-
Save soda92/24505553302c8dfb3a326719c352adae to your computer and use it in GitHub Desktop.
Swap mouse button, put this in $profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # PowerShell script to swap mouse buttons for left-handed mouse users. | |
| # (Make right mouse button the primary button...) | |
| $swapButtons = Add-Type -MemberDefinition @' | |
| [DllImport("user32.dll")] | |
| public static extern bool SwapMouseButton(bool swap); | |
| '@ -Name "NativeMethods" -Namespace "PInvoke" -PassThru | |
| function swapleft { | |
| # Use $true for left-handed mouse and $false for right-handed mouse. | |
| [bool]$returnValue = $swapButtons::SwapMouseButton($true) | |
| } | |
| function swapright { | |
| [bool]$returnValue = $swapButtons::SwapMouseButton($false) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment