#!/bin/bash

# calibrate touch
echo "ATTRS{name}==\"himax-touchscreen\", ENV{LIBINPUT_CALIBRATION_MATRIX}=\"0 -1 1 1 0 0\"" > /etc/udev/rules.d/99-astra-mobile-touch.rules
echo >> /etc/udev/rules.d/99-astra-mobile-touch.rules

# fix touch on fly-dm
rm /usr/share/X11/xorg.conf.d/41-evdev.conf

cat > /etc/X11/xorg.conf.d/ts11.conf <<EOF
Section "Monitor"
    Identifier   "Monitor0"
    VendorName   "Monitor Vendor"
    ModelName    "Monitor Model"
    Option "Rotate"    "right"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device     "Card0"
    Monitor    "Monitor0"
EndSection
EOF

echo "xinput map-to-output 'pointer:himax-touchscreen'  DSI-1" >> /etc/X11/fly-dm/Xsetup