This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: Vifon on Nov 8th, 2012  |  syntax: Bash  |  size: 0.42 KB  |  views: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/zsh
  2. getid()
  3. {
  4.         xinput list | grep -m 1 "$1" | sed 's/.*=\([^\t]*\).*/\1/'
  5. }
  6.  
  7. MOUSEID1=$(getid "TPPS/2 IBM TrackPoint")
  8.  
  9. if [ -z "$(xinput list | grep '2ndMouse')" ]; then
  10.         xinput create-master 2ndMouse
  11.         SECOND=$(getid 2ndMouse)
  12.         xinput reattach $MOUSEID1 $SECOND
  13. else
  14.         FIRST=$(getid "Virtual core pointer")
  15.         SECOND=$(getid 2ndMouse)
  16.         xinput reattach $MOUSEID1 $FIRST
  17.         xinput remove-master $SECOND
  18. fi
clone this paste RAW Paste Data