This commit is contained in:
Ray Elliott 2022-08-18 10:13:39 +01:00
parent 476b0ba197
commit e2a22c3e9f
1 changed files with 20 additions and 0 deletions

View File

@ -15,6 +15,26 @@ parent_id="$(xprop -id "$wid" WM_TRANSIENT_FOR | awk -F '# ' '{print $2}')"
if [ -n "$parent_id" ] ; then if [ -n "$parent_id" ] ; then
parent_class="$(xprop -id "$parent_id" WM_CLASS | awk -F '"' '{print $2}')" parent_class="$(xprop -id "$parent_id" WM_CLASS | awk -F '"' '{print $2}')"
if [ "$parent_class" = gimp ] ; then
parent_x="$(xdotool getwindowgeometry --shell $parent_id | grep X | awk -F '=' '{print $2}')"
parent_y="$(xdotool getwindowgeometry --shell $parent_id | grep Y | awk -F '=' '{print $2}')"
x="$((parent_x + 20))"
y="$((parent_y + 20))"
# without an echo, the xdotool command will not work.
# it appears that xdotool runs before the window is created if no echo is used.
# using a sleep command instead of echo just causes a delay in the window opening.
# so it appears the output to stdout (or whatever) causes bspwm to open the window
echo ""
xdotool windowmove "$wid" "$x" "$y"
exit
# notify-send $parent_id "$parent_class | $parent_x , $parent_y | $parent_width x $parent_height"
# notify-send $wid "$width x $height"
# (sleep 2 ; notify-send $wid "xdotool windowmove --sync $wid $x $y") &
fi
if [ "$parent_class" = chromium ] ; then if [ "$parent_class" = chromium ] ; then
parent_x="$(xdotool getwindowgeometry --shell $parent_id | grep X | awk -F '=' '{print $2}')" parent_x="$(xdotool getwindowgeometry --shell $parent_id | grep X | awk -F '=' '{print $2}')"
parent_y="$(xdotool getwindowgeometry --shell $parent_id | grep Y | awk -F '=' '{print $2}')" parent_y="$(xdotool getwindowgeometry --shell $parent_id | grep Y | awk -F '=' '{print $2}')"