code-snippets/shell/xinputmapping.sh

16 lines
896 B
Bash
Raw Normal View History

2024-04-08 18:35:01 -04:00
#!/bin/bash
# Gathering IDs of input devices
pointer_ids="$(xinput --list | sed -n '/slave.*pointer/p' | cut -f 2 -d '=' | cut -f 1 -d '[')"
# Get all outputs except for eDP1
connected_screens="$(xrandr | grep connected | sed '/disconnected/d' | sed '/eDP1/d' | cut -f 1 -d ' ')"
# Trying to map all the input devices to all the outputs
for screen in $connected_screens; do
for pointer in $pointer_ids; do
/usr/bin/xterm -e /bin/bash -c "/usr/bin/xinput --map-to-output $pointer $screen"
/usr/bin/xterm -e /bin/bash -c "/usr/bin/xinput set-props $pointer --type=float 'Coordinate Transformation Matrix' 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0"
/usr/bin/xterm -e /bin/bash -c "/usr/bin/xinput list-props $pointer > /tmp/input-xinput-listprops.log 2>/tmp/input-xinput-listprops.err.log"
/usr/bin/xterm -e /bin/bash -c "/usr/bin/xinput list > /tmp/xinput.log"
done
done