aboutsummaryrefslogtreecommitdiff
path: root/static_tablet_setup.sh
blob: 42886502e80c49510d6fa12e79a5b9ebfa74f501 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
#Clythsuriva

function press_any_key(){
	echo "Press any key to continue or 'q' to exit"
	while true ; do
		read -r -n 1 k<&1
		if [ "$k" = q ] ; then
			exit 1
		elif [ $? ] ; then
			return 0
		fi
	done
}

# If not done yet, install the wacom library and input driver
# xbps-install -Sy libwacom xf86-input-wacom
echo "Install the needed packages..."
echo "libwacom :"
xbps-query -l | grep -qw libwacom \
	|| sudo xbps-install -S libwacom
echo "xf86-input-wacom :"
xbps-query -l | grep -qw xf86-input-wacom \
	|| sudo xbps-install -S xf86-input-wacom
echo "...done."
press_any_key
# To see if the tablet and pen are recognized :
# xsetwacom list devices
echo "Recognized devices :"
xsetwacom list devices
press_any_key
# To look at the actual config of a component :
# xsetwacom -s get "<component>" all
# The s option can be ommitted, I use it because you need it to see button mapping.
echo "Actual configuration of "
press_any_key
# To look at the different parameters you can configure :
# xsetwacom list param
echo "Parameters :"
press_any_key
# To look at the keys you can use for the mapping process :
# xsetwacom list modifiers
echo "Modifiers :"
press_any_key
#
# You can look at the disposition and other stuffs of you tablet on /usr/share/libwacom/<brand>-<model>.tablet
# Exemple, for a Huion H420 :
# cat /usr/share/libwacom/huion-h420.tablet
# There's also a possibility to see an SVG file of the drawing at /usr/share/libwacom/layouts/<brand>-<model>.svg
echo "Disposition of your equipment :"
press_any_key
#
# Setting up the buttons
echo "Button setup :"
press_any_key
# on the tablet (pad)
echo "Tablet :"
xsetwacom set "HUION H420 Pad pad" Button 1 key "ctrl" key "s" #top
xsetwacom set "HUION H420 Pad pad" Button 2 key "ctrl" key "shift" key "z" #middle
xsetwacom set "HUION H420 Pad pad" Button 3 key "ctrl" key "z" #bot
press_any_key
# on the pen
echo "Pen :"
xsetwacom set "HUION H420 stylus" Button 3 key "e" #button facing up (not the click button on the top)
press_any_key
# Matching surface area to resolution of the main screen
echo "Matching surface area to the screen :"
xsetwacom set "HUION H420 stylus" MapToOutput eDP-1 #eDP-1 is the screen of my laptop, look at xrandr -q to see the one that you want to use
press_any_key