Skip to content

Instantly share code, notes, and snippets.

@talwrii
Created March 6, 2025 19:49
Show Gist options
  • Save talwrii/97d6de40d38e635d924d7e25ce799211 to your computer and use it in GitHub Desktop.
Save talwrii/97d6de40d38e635d924d7e25ce799211 to your computer and use it in GitHub Desktop.
#!/bin/bash
# This script clciks on the other window and presses enter
current_window=$(json-wmctrl | jq 'select(.focus) | .id')
# Extract x and y coordinates from the output
x=$(xdotool getmouselocation | cut -d ' ' -f 1 | cut -d ':' -f 2)
y=$(xdotool getmouselocation | cut -d ' ' -f 2 | cut -d ':' -f 2)
# Move x to the other side of the screen by mirroring along the middle
xdotool mousemove $((1920 - x)) $y
xdotool click 1
xdotool key Up
# press enter with xdotool
xdotool key Return
xdotool mousemove $x $y
wmctrl -i -a $current_window
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment