Last active
March 6, 2025 20:41
-
-
Save talwrii/14dbada36be9e12c919a6d3fa6bebe6a to your computer and use it in GitHub Desktop.
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 | |
# 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
This is a little script to press return in the "other window" when you have two windows open. It uses a little tool called json-wmctrl available in pypi to get the current window.
If you are interested in small tools like this you might like to