Skip to content

Commit

Permalink
mouse scripts updates
Browse files Browse the repository at this point in the history
  • Loading branch information
LeandroTreu committed Apr 22, 2024
1 parent 97dbf4c commit dfb55cf
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 16 deletions.
27 changes: 23 additions & 4 deletions mouse_scripts/mousehover.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
#!/bin/bash

# Set these according to screen size and element positions
hover_start_x=884
hover_start_y=670
recording_button_x=1683
recording_button_y=161
hover_iter=30 # Mouse-movements per hover
repetitions=5 # Number of straight line hovers

# Alt+Tab to the browser window
xdotool key Alt+Tab
sleep 0.5

# Set initial mouse position
xdotool mousemove --sync 800 480
# Start recording in devtools
xdotool mousemove --sync $recording_button_x $recording_button_y
xdotool click 1
sleep 0.5

hover_iter=30
repetitions=5

# Set initial mouse position
xdotool mousemove --sync $hover_start_x $hover_start_y

for ((r = 0; r < repetitions; r++)); do

Expand All @@ -27,3 +39,10 @@ for ((r = 0; r < repetitions; r++)); do
done

done

# Stop recording in devtools
xdotool mousemove --sync $recording_button_x $recording_button_y
xdotool click 1

# Alt+Tab back to the terminal
xdotool key Alt+Tab
41 changes: 34 additions & 7 deletions mouse_scripts/mousepanning.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,44 @@
#!/bin/bash

xdotool mousemove --sync 500 500
xdotool mousedown 1
# Set these according to screen size and element positions
panning_start_x=884
panning_start_y=400
recording_button_x=1683
recording_button_y=161
n_mousemove=20 # Mouse-movements per panning
panning_repetitions=5

# Alt+Tab to the browser window
xdotool key Alt+Tab
sleep 0.5

# Start recording in devtools
xdotool mousemove --sync $recording_button_x $recording_button_y
xdotool click 1
sleep 0.5

num_iterations=20

for ((i = 0; i < num_iterations; i++)); do
xdotool mousemove --sync $panning_start_x $panning_start_y
xdotool mousedown 1
for ((j = 0; j < panning_repetitions; j++)); do

sleep 0.025
xdotool mousemove_relative --sync 20 20
for ((i = 0; i < n_mousemove; i++)); do

sleep 0.025
xdotool mousemove_relative --sync 0 20
done
for ((i = 0; i < n_mousemove; i++)); do

sleep 0.025
xdotool mousemove_relative --sync -- 0 -20
done
done
xdotool mouseup 1


xdotool mouseup 1
# Stop recording in devtools
xdotool mousemove --sync $recording_button_x $recording_button_y
xdotool click 1

# Alt+Tab back to the terminal
xdotool key Alt+Tab
26 changes: 21 additions & 5 deletions mouse_scripts/scroll.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
#!/bin/bash

# Set these according to screen size and element positions
zoom_x=884
zoom_y=670
recording_button_x=1683
recording_button_y=161
delay=50 # In ms, between scroll ticks
repetitions=50

# Alt+Tab to the browser window
xdotool key Alt+Tab
sleep 0.5

# Set initial mouse position
xdotool mousemove --sync 737 558

delay=20
repetitions=600
# Start recording in devtools
xdotool mousemove --sync $recording_button_x $recording_button_y
xdotool click 1
sleep 0.5

# Set zoom mouse position
xdotool mousemove --sync $zoom_x $zoom_y
xdotool click --repeat $repetitions --delay $delay 4

# Stop recording in devtools
xdotool mousemove --sync $recording_button_x $recording_button_y
xdotool click 1

# Alt+Tab back to terminal
xdotool key Alt+Tab

0 comments on commit dfb55cf

Please sign in to comment.