Files
scripts/warpMouseAndWindow.sh
T

38 lines
889 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 getactivewindow windowsize 200 100
xdotool mousemove $1 $2
xdotool getactivewindow windowmove $1 $2
maximizeWindow
fi
}
case $1 in
1)
#moveWindowToMonitor 800 400 # top left of ultrawide display
moveWindowToMonitor 2080 2160 #15khz crt
;;
2)
moveWindowToMonitor 2650 500
;;
3)
moveWindowToMonitor 800 1600
;;
4)
#moveWindowToMonitor 2560 1600
moveWindowToMonitor 2180 1300
;;
esac