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

36 lines
771 B
Bash
Executable File

#!/bin/bash
focusWindowUnderMouse () {
xdotool windowactivate $(xdotool getmouselocation|sed "s/.*://")
}
maximizeWindow () {
wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz
}
unMaximizeWindow () {
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz
}
moveWindowToMonitor () {
if [ "$(xprop -id $(xdotool getmouselocation --shell | awk -F= '/WINDOW/{print $2}') WM_CLASS | awk -F\" '{print $4}')" != "plasmashell" ]; then
unMaximizeWindow
xdotool getactivewindow windowsize 800 600
xdotool mousemove $1 $2
xdotool getactivewindow windowmove $1 $2
maximizeWindow
fi
}
case $1 in
1)
moveWindowToMonitor 800 400
;;
2)
moveWindowToMonitor 2650 500
;;
3)
moveWindowToMonitor 800 1600
;;
4)
#moveWindowToMonitor 2560 1600
moveWindowToMonitor 2180 1300
;;
esac