#!/bin/bash
by=-47;
bx=-303;

by=$((by*4))

ofsx=(-1 1 -1 1)
ofsy=(-2 -2 2 2)
nw=0;
while read wi; do
	x=$bx;
	y=$by;
	
	x=$((x+${ofsx[nw]}))
	y=$((y+${ofsy[nw]}))
	
	xdotool windowmove -- $wi $x $y;
	nw=$((nw+1));
done < <(
	xdotool search --name '^OSD-0000$'
);

xdotool search --name '^OSD-ffff$' windowmove -- $bx $by
xdotool search --name '^OSD-(0000|ffff)$' |
while read wi; do
	xdotool windowsize $wi 1920 1080;
done

{
	xdotool search --name '^OSD-0000$'
	xdotool search --name '^OSD-ffff$'
} |
while read wi; do
	xdotool windowactivate $wi
	sleep 0.1
done
