Created
July 19, 2017 13:23
-
-
Save mauricioprado00/30f3375a9dbcab7801fb66b8f37ae0a2 to your computer and use it in GitHub Desktop.
show from source for phpstorm in ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# requires: imagemagik, xdotool, xwininfo | |
window_id=$(xwininfo -tree -root | grep 'PhpStorm 2016.2.2' | awk '{print $1}') | |
window_x=$(xwininfo -id $window_id | grep 'Absolute upper-left X' | awk '{print $NF}') | |
window_y=$(xwininfo -id $window_id | grep 'Absolute upper-left Y' | awk '{print $NF}') | |
import -window $window_id /tmp/screenshot.jpg | |
convert -crop 250x40+200+45 /tmp/screenshot.jpg /tmp/toolbar.jpg | |
position=$(compare -metric RMSE -subimage-search /tmp/toolbar.jpg ~/show-from-source.jpg similarity.jpg 2>&1 | awk '{print $NF}') | |
rel_x=$(echo $position | awk -F ',' '{print $1}') | |
rel_y=$(echo $position | awk -F ',' '{print $2}') | |
abs_x=$(($window_x + $rel_x + 200)) | |
abs_y=$(($window_y + $rel_y + 45)) | |
xdotool mousemove $abs_x $abs_y click 1 | |
sleep 0.3 | |
xdotool click 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
could also use