Files
scripts/alttab.sh
T
2026-06-11 13:47:48 -04:00

20 lines
522 B
Bash
Executable File

#!/bin/bash
mousewarp ()
{
HERE="$(xdotool getwindowfocus)"
ULX=$(xwininfo -id "$HERE" | grep " Absolute upper-left X:" | awk '{print $4}')
ULY=$(xwininfo -id "$HERE" | grep " Absolute upper-left Y:" | awk '{print $4}')
# If there is no window, ULX == 1 and ULY == 1.
if [ "$ULX" != "-1" ] || [ "$ULY" != "-1" ]; then
eval "$(xdotool getwindowgeometry --shell "$HERE")"
((NX="$WIDTH"/2))
((NY="$HEIGHT"/2))
xdotool mousemove --window "$WINDOW" "$NX" "$NY"
fi
}
rofi -show window -show-icons
mousewarp