From 1f27d50aa8be8298f55a0ad2b4708a17190f0382 Mon Sep 17 00:00:00 2001
From: SinTan1729 <sayantan.santra689@gmail.com>
Date: Fri, 26 Nov 2021 12:12:54 -0600
Subject: [PATCH] improved huion-tablet-setup instructions so that script is
 autorun whenever tablet is connected

---
 huion-tablet-setup.sh | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/huion-tablet-setup.sh b/huion-tablet-setup.sh
index a8ee245..070a8f1 100755
--- a/huion-tablet-setup.sh
+++ b/huion-tablet-setup.sh
@@ -7,13 +7,22 @@
 # sed -i 's/SUBDIRS=/M=/' Makefile
 # sudo make dkms_install
 
+# Make /etc/udev/rules.d/00-usb-huion.rules with this content (to run it whenever the tabler is conencted):
+# ACTION=="add", ATTRS{idVendor}=="256c", ATTRS{idProduct}=="006d", ENV{XAUTHORITY}="/home/sintan/.Xauthority", ENV{DISPLAY}=":0", OWNER=<user>, RUN+="/usr/local/bin/huion-tablet-mount"
+
+# Make /usr/local/bin/huion-tablet-mount with this content :
+# #!/bin/bash
+# <location-of-this-script> & exit
+
 # Make sure to install xf86-input-wacom (might have to restart)
 # Add this script to autostart
 
+sleep 1
+
 xsetwacom --set 'HID 256c:006d Pen stylus' Button 2 "1"
 xsetwacom --set 'HID 256c:006d Pen stylus' Button 3 "3"
-xsetwacom --set 'HID 256c:006d Pad pad' Button 1 "1"
-xsetwacom --set 'HID 256c:006d Pad pad' Button 2 "3"
+xsetwacom --set 'HID 256c:006d Pad pad' Button 1 "key +ctrl +s -s -ctrl"
+xsetwacom --set 'HID 256c:006d Pad pad' Button 2 "key +ctrl +e -e -ctrl"
 xsetwacom --set 'HID 256c:006d Pad pad' Button 3 "4"
 xsetwacom --set 'HID 256c:006d Pad pad' Button 8 "5"
 xsetwacom --set 'HID 256c:006d Pad pad' Button 9 "key +ctrl +z -z -ctrl"