From a3d2452da3859ec1816ee4f15bd3e373951c6f7c Mon Sep 17 00:00:00 2001 From: tmont Date: Mon, 1 Nov 2021 17:17:59 -0700 Subject: [PATCH] script to move x window to other display...ish --- scripts/move-window-to-other-display.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 scripts/move-window-to-other-display.sh diff --git a/scripts/move-window-to-other-display.sh b/scripts/move-window-to-other-display.sh new file mode 100755 index 0000000..d93a960 --- /dev/null +++ b/scripts/move-window-to-other-display.sh @@ -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