script to move x window to other display...ish

This commit is contained in:
tmont 2021-11-01 17:17:59 -07:00
parent b8e7f61bd2
commit a3d2452da3

View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -ueo pipefail
# assuming that all display's are the same width
displayWidth=$(xdotool getdisplaygeometry | cut -d' ' -f1)
xPos=$(xdotool getactivewindow getwindowgeometry | grep Position: | cut -d: -f2 | cut -d, -f1 | tr -d ' ')
echo "current x: ${xPos}"
newXPos=
if [[ "${xPos}" -ge "${displayWidth}" ]]; then
newXPos="-${displayWidth}"
else
newXPos="${displayWidth}"
fi
echo "new x: ${newXPos}"
# i don't know why the y value is offset, but it is what it is
xdotool getactivewindow windowmove --relative -- "${newXPos}" -50