多个键盘和鼠标输入

Rad*_*ado 5 linux mouse keyboard

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

Rad*_*ado 4

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

#!/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
Run Code Online (Sandbox Code Playgroud)