Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a linux laptop connected to an external monitor, keyboard and mouse. How can I have the laptop's keyboard and trackpad be independent from the external keyboard and mouse so I can keep them exclusively on the laptop's screen and use the external keyboard and mouse primarily on the external monitor?

share|improve this question
up vote 4 down vote accepted

I found a solution to the problem and I wrote a script to toggle mouse and keyboard splitting:

#!/bin/bash

xinput list | grep "main keyboard" -c > /dev/null

if [ $? -ne 0 ]; then
  echo "Splitting laptop leyboard and touchpad..."
  echo "Creating xinput main"
  xinput create-master "main"
  echo "Reattaching laptop touchpad and keyboard to main"
  xinput reattach "SynPS/2 Synaptics TouchPad" "main pointer"
  xinput reattach "AT Translated Set 2 keyboard" "main keyboard"
else
  echo "Merging laptop keyboard and touchpad..."
  echo "Reattaching laptop touchpad and keyboard to core"
  xinput reattach "SynPS/2 Synaptics TouchPad" "Virtual core pointer"
  xinput reattach "AT Translated Set 2 keyboard" "Virtual core keyboard"
  echo "Removing xinput main"
  xinput remove-master "main keyboard"
fi
share|improve this answer
    
+1 nice example. It also helps for 1) dual cursor 2) dual inputs – YumYumYum May 7 '12 at 11:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .