Skip to content

Instantly share code, notes, and snippets.

@Deradon
Created February 8, 2013 00:29
Show Gist options
  • Save Deradon/4735537 to your computer and use it in GitHub Desktop.
Save Deradon/4735537 to your computer and use it in GitHub Desktop.
HP-Notebook - Disable/Enable touchpad on command-line
#!/usr/bin/env ruby
# Simple script to disable TouchPad on HP-Notebook
#
# Usage: touchpad-disable
#
# Installation: save file to ~/bin/touchpad-disable (may chmod +X it)
#
def run(cmd, options = {:show => true})
puts "> #{cmd}"
`#{cmd}`.tap { |r| puts(r) if options[:show] && !r.empty? }
end
line = run "xinput list | grep TouchPad"
id = line[/.*\tid=(\d+)\t.*/, 1]
run "xinput set-prop #{id} 'Device Enabled' 0"
#!/usr/bin/env ruby
# Simple script to enable TouchPad on HP-Notebook
#
# Usage: touchpad-enable
#
# Installation: save file to ~/bin/touchpad-enable (may chmod +X it)
#
def run(cmd, options = {:show => true})
puts "> #{cmd}"
`#{cmd}`.tap { |r| puts(r) if options[:show] && !r.empty? }
end
line = run "xinput list | grep TouchPad"
id = line[/.*\tid=(\d+)\t.*/, 1]
run "xinput set-prop #{id} 'Device Enabled' 1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment