aboutsummaryrefslogtreecommitdiff
path: root/experiments/draw/lib.sh
blob: 90e5689834a4f6f6aa40a14ed946623c5fc93397 (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
WINDOW="$(xdotool search --onlyvisible --maxdepth 2 --class melonDS | head -n1)"
[ -z "$WINDOW" ] && exit 1

eval "$(xdotool getwindowgeometry --shell "$WINDOW")"

sleep 0.5

bottom_screen() {
	xdotool mousemove $X $Y
	# skip menu bar
	xdotool mousemove_relative 0 20
	# skip top screen
	xdotool mousemove_relative 0 192

	xdotool mousemove_relative -- $1 $2
}

tap() {
	xdotool mousedown 1
	sleep 0.02
	xdotool mouseup 1
	sleep 0.02
}

eraser() {
	bottom_screen 8 60
	tap
}

pen() {
	bottom_screen 8 44
	tap
}

small() {
	bottom_screen 8 92
	tap
}

big() {
	bottom_screen 8 76
	tap
}

msg_clear() {
	bottom_screen 240 170
	tap
}