Created
November 17, 2016 13:55
-
-
Save lpenz/1e47c40e8638a7924dab10d061e1da0f to your computer and use it in GitHub Desktop.
Click a window selected by name; uses xwininfo and xdotool
This file contains hidden or 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
#!/bin/bash | |
WINNAME="${1?usage: "$0" windowname}" | |
set -e | |
TMP=$(mktemp) | |
trap 'rm -f $TMP' EXIT | |
eval "$(xdotool getmouselocation --shell)" | |
xwininfo -name "$WINNAME" > "$TMP" | |
win_x=$(sed -n 's@Absolute upper-left X:\s*\([0-9]\+\)$@\1@p' "$TMP") | |
win_y=$(sed -n 's@Absolute upper-left Y:\s*\([0-9]\+\)$@\1@p' "$TMP") | |
xdotool mousemove $((win_x+10)) $((win_y+10)) | |
xdotool click 1 | |
xdotool mousemove "$X" "$Y" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment