多种键盘和鼠标输入

多种键盘和鼠标输入

我有一台连接到外接显示器、键盘和鼠标的 Linux 笔记本电脑。如何让笔记本电脑的键盘和触控板独立于外接键盘和鼠标,以便我可以将它们专门保留在笔记本电脑的屏幕上,并主要在外接显示器上使用外接键盘和鼠标?

答案1

我找到了解决问题的方法,并编写了一个脚本来切换鼠标和键盘分割:

#!/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

相关内容