Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/bin/bash
- # vim: si ts=4 sw=4
- shopt -s extglob
- IFS=$'\n' DEVICE_LIST=( $(xinput list --short) )
- for (( I=0; I<${#DEVICE_LIST[@]}; I++ )); do
- IFS=$'\t' INFO=( ${DEVICE_LIST[$I]} )
- [ "${INFO[2]:1:1}" = "s" ] || continue
- NAME="${INFO[0]:6}"
- NAME="${NAME%%*([[:blank:]])}"
- ID="${INFO[1]#id=}"
- [[ "$NAME" != *XTEST* ]] || continue
- case "${INFO[2]:8:1}" in
- "p" )
- POINTERS+=( "$ID"$'\t'"$NAME" )
- ;;
- "k" )
- KEYBOARDS+=( "$ID"$'\t'"$NAME" )
- ;;
- esac
- done
- POINTER="$( IFS=$'\t' zenity --title="Select device" --list --text="Choose a pointer" --column="Id" --column="Name" ${POINTERS[@]} )"
- KEYBOARD="$( IFS=$'\t' zenity --title="Select device" --list --text="Choose a keyboard" --column="Id" --column="Name" ${KEYBOARDS[@]} )"
- [ -n "$POINTER" ] && [ -n "$KEYBOARD" ] || exit 1
- MASTER_NAME="second"
- xinput create-master "$MASTER_NAME"
- xinput reattach "$POINTER" "$MASTER_NAME pointer"
- xinput reattach "$KEYBOARD" "$MASTER_NAME keyboard"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement