my dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

32 lines
1.3 KiB

#!/usr/bin/env bash
TRANSFORM='Coordinate Transformation Matrix'
if [[ $1 == "edp" ]]; then
SCREEN="eDP"
OFFSREEN="HDMI-A-0"
TOUCHPAD='ELAN469D:00 04F3:304B Touchpad'
ROT=$(xrandr --query --verbose | grep $SCREEN | cut -d ' ' -f 6)
if [[ "$ROT" == "left" ]]; then
xrandr --output $SCREEN --auto --rotate normal --output $OFFSCREEN --off
xinput set-prop "$TOUCHPAD" "$TRANSFORM" 1 0 0 0 1 0 0 0 1
else
xrandr --output $SCREEN --auto --rotate left --output $OFFSCREEN --off
xinput set-prop "$TOUCHPAD" "$TRANSFORM" 0 -1 1 1 0 0 0 0 1
fi
elif [[ $1 == "hdmi" ]]; then
SCREEN="HDMI-A-0"
OFFSCREEN="eDP"
ROT=$(xrandr --query --verbose | grep $SCREEN | cut -d ' ' -f 5)
if [[ "$ROT" == "right" ]]; then
xrandr --output $SCREEN --auto --rotate normal --output $OFFSCREEN --off
else
xrandr --output $SCREEN --auto --rotate right --output $OFFSCREEN --off
fi
elif [[ $1 == "reset" ]]; then
xrandr --output eDP --auto --rotate normal --pos 1920x312 --right-of HDMI-A-0 --output HDMI-A-0 --auto --rotate normal
xinput set-prop $2 --type=float "Coordinate Transformation Matrix" 0.584297018 0 0 0 1 0 0 0 1
ROT=$(xrandr --query --verbose | grep "eDP" | cut -d ' ' -f 6)
if [[ $ROT == "left" ]]; then
xinput set-prop "$TOUCHPAD" "$TRANSFORM" 1 0 0 0 1 0 0 0 1
fi
fi