Skip to content

Instantly share code, notes, and snippets.

@shapr
Created April 26, 2017 17:25
Show Gist options
  • Select an option

  • Save shapr/a260256a5a52075a2a1b0ca64a3d11c0 to your computer and use it in GitHub Desktop.

Select an option

Save shapr/a260256a5a52075a2a1b0ca64a3d11c0 to your computer and use it in GitHub Desktop.
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