Created
April 26, 2017 17:25
-
-
Save shapr/a260256a5a52075a2a1b0ca64a3d11c0 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
| module Main where | |
| import System.Process (readProcess, callCommand) | |
| import Data.List (isInfixOf, words) | |
| import Data.List.Split (splitOn) | |
| main = do res <- readProcess "xinput" ["list"] "" | |
| let devices = (filter (isInfixOf "TouchPad") (lines res)) | |
| let ids = concatMap (filter (isInfixOf "id=") . words) devices | |
| mapM_ (callCommand . buildDisable) (map delId ids) | |
| print "disabled devices:" | |
| mapM_ print devices | |
| buildDisable x = "xinput set-prop " ++ x ++ " \"Device Enabled\" 0" | |
| -- "id=12" -> "12" | |
| delId ('i':'d':'=':xs) = xs | |
| delId _ = [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment