Created
September 28, 2020 07:44
-
-
Save codec-abc/7e58dbea7bb665599ae72d5762f3d456 to your computer and use it in GitHub Desktop.
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
| open System.Text | |
| open System.Text.RegularExpressions | |
| let p = new System.Diagnostics.Process() | |
| p.StartInfo.FileName <- "xinput" | |
| p.StartInfo.Arguments <- ("list") | |
| p.StartInfo.RedirectStandardOutput <- true | |
| p.StartInfo.UseShellExecute <- false | |
| p.Start() | |
| let output = p.StandardOutput.ReadToEnd() | |
| let lines = output.Split('\n') | |
| for line in lines do | |
| let r = new Regex(@"id=([0-9]*)", RegexOptions.IgnoreCase) | |
| if line.Contains("Optical Mouse") then | |
| let matches = r.Match(line) | |
| let group = matches.Groups.[1].ToString() | |
| printfn "%s" group | |
| let p = new System.Diagnostics.Process() | |
| p.StartInfo.FileName <- "xinput" | |
| let arg = "set-prop " + group + " \"Device Accel Constant Deceleration\" 3" | |
| printfn "%s" arg | |
| p.StartInfo.Arguments <- (arg) | |
| p.StartInfo.RedirectStandardOutput <- true | |
| p.StartInfo.UseShellExecute <- false | |
| p.Start() |> ignore | |
| printfn "done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment