Created
December 9, 2021 09:30
-
-
Save josuemtzmo/2e3702588c45204b6e6b8179a25703f3 to your computer and use it in GitHub Desktop.
Function to shifts all windows within xQuartz to a given location.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This function shifts all windows within xQuartz to a given location. | |
# Its required to `brew install xdotool` | |
# The arguments of this function correspond to: | |
# $1 [string] == Name of window to shift | |
# $2 [int] == X coordinate in screen space (pixels, for example 800) | |
# $3 [int] == Y coordinate in screen space (pixels, for example 1000) | |
# Usage example: | |
# move_xquartz_windows Ncview 800 1000 | |
move_xquartz_windows () { | |
windows=$(xwininfo -tree -root | grep $1) | |
screen_hex=() | |
echo $windows | while read line | |
do | |
screen_hex+=$(echo $line | { read first rest ; echo $first ; }) | |
done | |
for screen in $screen_hex; | |
do | |
xdotool windowmove $screen $2 $3 | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment