Re: Getting and setting window size and position

Jack <[email protected]> Wed, 3 Sep 2025 20:00:33 +0300
Newsgroups gmane.comp.xfce.user
Message-ID <CAH8MQ5yBSWsM+qH4AntHygZK5Sj8GOS5k28YyfaDUUAu+gsKXw@mail.gmail.com>
--===============8167815639117674377==
Content-Type: multipart/alternative; boundary="00000000000098ec80063de88bf1"

--00000000000098ec80063de88bf1
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

The latest version of the code is available here
<https://gist.github.com/mlauronen/cb3dc7bf0e5fa4ef7f86aafaf20e73e1>.

On Wed, Sep 3, 2025 at 4:10=E2=80=AFPM Jack <[email protected]> wrote:

> Here=E2=80=99s my script, which gets the job done. It should work with bo=
th
> terminal-style and regular application windows in a multi-monitor setup.
> Thank you.
>
> #!/bin/bash
>
> if [ $# -ne 2 ]; then
>     echo "Usage: $0 <window_id> <command>"
>     echo "<window_id> can be:"
>     echo "  number      Window ID (e.g., 0x1a0000 or 123456)"
>     echo "  '.'         Current active window"
>     echo "  name        Partial window name (e.g., 'firefox')"
>     echo "Commands:"
>     echo "  -1          lower left corner"
>     echo "  -2          bottom side"
>     echo "  -3          lower right corner"
>     echo "  -4          left side"
>     echo "  -5          full screen"
>     echo "  -6          right side"
>     echo "  -7          upper left corner"
>     echo "  -8          top side"
>     echo "  -9          upper right corner"
>     echo "  -gX,Y,W,H   move and resize"
>     exit 1
> fi
>
> WINDOW_ID=3D"$1"
> COMMAND=3D"$2"
>
> # Handle WINDOW_ID input
> if [ "$WINDOW_ID" =3D "." ]; then
>     # Get active window ID
>     WINDOW_ID=3D$(xdotool getactivewindow)
>     if [ -z "$WINDOW_ID" ]; then
>         echo "Error: No active window found"
>         exit 1
>     fi
> elif [[ ! "$WINDOW_ID" =3D~ ^[0-9]+$ ]]; then
>     # Treat as partial window name if not a number
>     WINDOW_ID=3D$(wmctrl -l | grep -i "$WINDOW_ID" | head -n 1 | awk '{pr=
int
> $1}')
>     if [ -z "$WINDOW_ID" ]; then
>         echo "Error: No window found matching partial name: $1"
>         exit 1
>     fi
> fi
>
> # Verify window ID is valid
> if ! xwininfo -id "$WINDOW_ID" >/dev/null 2>&1; then
>     echo "Error: Invalid window ID: $WINDOW_ID"
>     exit 1
> fi
>
> wmctrl -ir "$WINDOW_ID" -b remove,maximized_vert,maximized_horz
>
> ABSOLUTE_X=3D$(xwininfo -id "$WINDOW_ID" | grep "Absolute upper-left X:" =
|
> awk '{print $4}')
> ABSOLUTE_Y=3D$(xwininfo -id "$WINDOW_ID" | grep "Absolute upper-left Y:" =
|
> awk '{print $4}')
>
> RELATIVE_X=3D$(xwininfo -id "$WINDOW_ID" | grep "Relative upper-left X:" =
|
> awk '{print $4}')
> RELATIVE_Y=3D$(xwininfo -id "$WINDOW_ID" | grep "Relative upper-left Y:" =
|
> awk '{print $4}')
>
> WIDTH_FIX=3D$((-(RELATIVE_X * 2)))
> HEIGHT_FIX=3D$((-(RELATIVE_Y + RELATIVE_X)))
>
> MONITOR_INFO=3D$(xrandr --current)
> MONITOR_X=3D0
> MONITOR_Y=3D0
> MONITOR_WIDTH=3D1920
> MONITOR_HEIGHT=3D1080
>
> # Loop through xrandr output to find the correct monitor based on window
> position
> while read -r line; do
>     if [[ $line =3D~ ([0-9]+)x([0-9]+)\+([0-9]+)\+([0-9]+) ]]; then
>         MON_W=3D${BASH_REMATCH[1]}
>         MON_H=3D${BASH_REMATCH[2]}
>         MON_X=3D${BASH_REMATCH[3]}
>         MON_Y=3D${BASH_REMATCH[4]}
>
>         # Check if the window is within this monitor's coordinates
>         if (( ABSOLUTE_X >=3D MON_X && ABSOLUTE_X < MON_X + MON_W &&
> ABSOLUTE_Y >=3D MON_Y && ABSOLUTE_Y < MON_Y + MON_H )); then
>             MONITOR_WIDTH=3D$MON_W
>             MONITOR_HEIGHT=3D$MON_H
>             MONITOR_X=3D$MON_X
>             MONITOR_Y=3D$MON_Y
>             break
>         fi
>     fi
> done <<< "$MONITOR_INFO"
>
> HALF_WIDTH=3D$((MONITOR_WIDTH / 2))
> HALF_HEIGHT=3D$((MONITOR_HEIGHT / 2))
>
> case $COMMAND in
>     -1)
>         xdotool windowmove "$WINDOW_ID" $MONITOR_X $((MONITOR_Y +
> HALF_HEIGHT))
>         xdotool windowsize "$WINDOW_ID" $((HALF_WIDTH + WIDTH_FIX))
> $((HALF_HEIGHT + HEIGHT_FIX))
>         ;;
>     -2)
>         xdotool windowmove "$WINDOW_ID" $MONITOR_X $((MONITOR_Y +
> HALF_HEIGHT))
>         xdotool windowsize "$WINDOW_ID" $((MONITOR_WIDTH + WIDTH_FIX))
> $((HALF_HEIGHT + HEIGHT_FIX))
>         ;;
>     -3)
>         xdotool windowmove "$WINDOW_ID" $((MONITOR_X + HALF_WIDTH))
> $((MONITOR_Y + HALF_HEIGHT))
>         xdotool windowsize "$WINDOW_ID" $((HALF_WIDTH + WIDTH_FIX))
> $((HALF_HEIGHT + HEIGHT_FIX))
>         ;;
>     -4)
>         xdotool windowmove "$WINDOW_ID" $MONITOR_X $MONITOR_Y
>         xdotool windowsize "$WINDOW_ID" $((HALF_WIDTH + WIDTH_FIX))
> $((MONITOR_HEIGHT + HEIGHT_FIX))
>         ;;
>     -5)
>         xdotool windowmove "$WINDOW_ID" $MONITOR_X $MONITOR_Y
>         xdotool windowsize "$WINDOW_ID" $((MONITOR_WIDTH + WIDTH_FIX))
> $((MONITOR_HEIGHT + HEIGHT_FIX))
>         ;;
>     -6)
>         xdotool windowmove "$WINDOW_ID" $((MONITOR_X + HALF_WIDTH))
> $MONITOR_Y
>         xdotool windowsize "$WINDOW_ID" $((HALF_WIDTH + WIDTH_FIX))
> $((MONITOR_HEIGHT + HEIGHT_FIX))
>         ;;
>     -7)
>         xdotool windowmove "$WINDOW_ID" $MONITOR_X $MONITOR_Y
>         xdotool windowsize "$WINDOW_ID" $((HALF_WIDTH + WIDTH_FIX))
> $((HALF_HEIGHT + HEIGHT_FIX))
>         ;;
>     -8)
>         xdotool windowmove "$WINDOW_ID" $MONITOR_X $MONITOR_Y
>         xdotool windowsize "$WINDOW_ID" $((MONITOR_WIDTH + WIDTH_FIX))
> $((HALF_HEIGHT + HEIGHT_FIX))
>         ;;
>     -9)
>         xdotool windowmove "$WINDOW_ID" $((MONITOR_X + HALF_WIDTH))
> $MONITOR_Y
>         xdotool windowsize "$WINDOW_ID" $((HALF_WIDTH + WIDTH_FIX))
> $((HALF_HEIGHT + HEIGHT_FIX))
>         ;;
>     -g*)
>         GEOM=3D"${COMMAND:2}" # strip "-g"
>         IFS=3D',' read -r GX GY GW GH <<< "$GEOM"
>         if [[ -n $GX && -n $GY && -n $GW && -n $GH ]]; then
>             xdotool windowmove "$WINDOW_ID" "$GX" "$GY"
>             xdotool windowsize "$WINDOW_ID" "$((GW + WIDTH_FIX))" "$((GH =
+
> HEIGHT_FIX))"
>         else
>             echo "Error: invalid geometry format. Use -gX,Y,W,H"
>             exit 1
>         fi
>         ;;
>     *)
>         echo "Error: Unknown command: $COMMAND"
>         exit 1
>         ;;
> esac
>
>
> On Wed, Sep 3, 2025 at 10:43=E2=80=AFAM Jack <[email protected]> wrote:
>
>> I have three monitors running six virtual desktops, all filled with
>> applications some are tiled and some are floating. I'm currently writing=
 a
>> script to manage them, but it's making me consider just switching to i3 =
:)
>>
>> On Wed, Sep 3, 2025 at 10:29=E2=80=AFAM killermoehre <[email protected]=
et>
>> wrote:
>>
>>> Am Mittwoch, dem 03.09.2025 um 10:17 +0300 schrieb Jack:
>>>
>>> Unfortunately, *built-in commands cannot be used* because after using
>>> them, the window size can no longer be changed programmatically (ie. fr=
om
>>> the scripts). This is because if you switch to another desktop and then
>>> return, the window manager no longer correctly remembers the modified
>>> window sizes. This is precisely why I'm creating my own script for this
>>> purpose.
>>>
>>> A really long time ago I wrote
>>> https://github.com/killermoehre/window-gridder for this purpose, but
>>> abondend it, because Xfwm4 hat inbuild what I need and it has problems =
with
>>> client side decorations.
>>>
>>> You can use it at a starting point.
>>>
>>> But IMHO it sounds like you want more of a tiling WM and not a floating
>>> one, right? Xfce allows to simply *replace* the current WM with another
>>> one. I wrote https://wiki.xfce.org/howto/other_window_manager for this.
>>> _______________________________________________
>>> Xfce mailing list
>>> [email protected]
>>> https://mail.xfce.org/mailman/listinfo/xfce
>>> http://www.xfce.org
>>>
>>

--00000000000098ec80063de88bf1
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">The latest version of the code is available=C2=A0<a href=
=3D"https://gist.github.com/mlauronen/cb3dc7bf0e5fa4ef7f86aafaf20e73e1">her=
e</a>.</div><br><div class=3D"gmail_quote gmail_quote_container"><div dir=
=3D"ltr" class=3D"gmail_attr">On Wed, Sep 3, 2025 at 4:10=E2=80=AFPM Jack &=
lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; wrote:<=
br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e=
x;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"=
>Here=E2=80=99s my script, which gets the job done. It should work with bot=
h terminal-style and regular application windows in a multi-monitor setup.<=
br>Thank you.<br><br>#!/bin/bash<br><br>if [ $# -ne 2 ]; then<br>=C2=A0 =C2=
=A0 echo &quot;Usage: $0 &lt;window_id&gt; &lt;command&gt;&quot;<br>=C2=A0 =
=C2=A0 echo &quot;&lt;window_id&gt; can be:&quot;<br>=C2=A0 =C2=A0 echo &qu=
ot; =C2=A0number =C2=A0 =C2=A0 =C2=A0Window ID (e.g., 0x1a0000 or 123456)&q=
uot;<br>=C2=A0 =C2=A0 echo &quot; =C2=A0&#39;.&#39; =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 Current active window&quot;<br>=C2=A0 =C2=A0 echo &quot; =C2=A0name =
=C2=A0 =C2=A0 =C2=A0 =C2=A0Partial window name (e.g., &#39;firefox&#39;)&qu=
ot;<br>=C2=A0 =C2=A0 echo &quot;Commands:&quot;<br>=C2=A0 =C2=A0 echo &quot=
; =C2=A0-1 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0lower left corner&quot;<br>=C2=
=A0 =C2=A0 echo &quot; =C2=A0-2 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0bottom si=
de&quot;<br>=C2=A0 =C2=A0 echo &quot; =C2=A0-3 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0lower right corner&quot;<br>=C2=A0 =C2=A0 echo &quot; =C2=A0-4 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0left side&quot;<br>=C2=A0 =C2=A0 echo &quot; =
=C2=A0-5 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0full screen&quot;<br>=C2=A0 =C2=
=A0 echo &quot; =C2=A0-6 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0right side&quot;=
<br>=C2=A0 =C2=A0 echo &quot; =C2=A0-7 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0up=
per left corner&quot;<br>=C2=A0 =C2=A0 echo &quot; =C2=A0-8 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0top side&quot;<br>=C2=A0 =C2=A0 echo &quot; =C2=A0-9 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0upper right corner&quot;<br>=C2=A0 =C2=A0=
 echo &quot; =C2=A0-gX,Y,W,H =C2=A0 move and resize&quot;<br>=C2=A0 =C2=A0 =
exit 1<br>fi<br><br>WINDOW_ID=3D&quot;$1&quot;<br>COMMAND=3D&quot;$2&quot;<=
br><br># Handle WINDOW_ID input<br>if [ &quot;$WINDOW_ID&quot; =3D &quot;.&=
quot; ]; then<br>=C2=A0 =C2=A0 # Get active window ID<br>=C2=A0 =C2=A0 WIND=
OW_ID=3D$(xdotool getactivewindow)<br>=C2=A0 =C2=A0 if [ -z &quot;$WINDOW_I=
D&quot; ]; then<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 echo &quot;Error: No active =
window found&quot;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 exit 1<br>=C2=A0 =C2=A0 f=
i<br>elif [[ ! &quot;$WINDOW_ID&quot; =3D~ ^[0-9]+$ ]]; then<br>=C2=A0 =C2=
=A0 # Treat as partial window name if not a number<br>=C2=A0 =C2=A0 WINDOW_=
ID=3D$(wmctrl -l | grep -i &quot;$WINDOW_ID&quot; | head -n 1 | awk &#39;{p=
rint $1}&#39;)<br>=C2=A0 =C2=A0 if [ -z &quot;$WINDOW_ID&quot; ]; then<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 echo &quot;Error: No window found matching part=
ial name: $1&quot;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 exit 1<br>=C2=A0 =C2=A0 f=
i<br>fi<br><br># Verify window ID is valid<br>if ! xwininfo -id &quot;$WIND=
OW_ID&quot; &gt;/dev/null 2&gt;&amp;1; then<br>=C2=A0 =C2=A0 echo &quot;Err=
or: Invalid window ID: $WINDOW_ID&quot;<br>=C2=A0 =C2=A0 exit 1<br>fi<br><b=
r>wmctrl -ir &quot;$WINDOW_ID&quot; -b remove,maximized_vert,maximized_horz=
<br><br>ABSOLUTE_X=3D$(xwininfo -id &quot;$WINDOW_ID&quot; | grep &quot;Abs=
olute upper-left X:&quot; | awk &#39;{print $4}&#39;)<br>ABSOLUTE_Y=3D$(xwi=
ninfo -id &quot;$WINDOW_ID&quot; | grep &quot;Absolute upper-left Y:&quot; =
| awk &#39;{print $4}&#39;)<br><br>RELATIVE_X=3D$(xwininfo -id &quot;$WINDO=
W_ID&quot; | grep &quot;Relative upper-left X:&quot; | awk &#39;{print $4}&=
#39;)<br>RELATIVE_Y=3D$(xwininfo -id &quot;$WINDOW_ID&quot; | grep &quot;Re=
lative upper-left Y:&quot; | awk &#39;{print $4}&#39;)<br><br>WIDTH_FIX=3D$=
((-(RELATIVE_X * 2)))<br>HEIGHT_FIX=3D$((-(RELATIVE_Y + RELATIVE_X)))<br><b=
r>MONITOR_INFO=3D$(xrandr --current)<br>MONITOR_X=3D0<br>MONITOR_Y=3D0<br>M=
ONITOR_WIDTH=3D1920<br>MONITOR_HEIGHT=3D1080<br><br># Loop through xrandr o=
utput to find the correct monitor based on window position<br>while read -r=
 line; do<br>=C2=A0 =C2=A0 if [[ $line =3D~ ([0-9]+)x([0-9]+)\+([0-9]+)\+([=
0-9]+) ]]; then<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 MON_W=3D${BASH_REMATCH[1]}<b=
r>=C2=A0 =C2=A0 =C2=A0 =C2=A0 MON_H=3D${BASH_REMATCH[2]}<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 MON_X=3D${BASH_REMATCH[3]}<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 MON=
_Y=3D${BASH_REMATCH[4]}<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 <br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 # Check if the window is within this monitor&#39;s coordinate=
s<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (( ABSOLUTE_X &gt;=3D MON_X &amp;&amp; =
ABSOLUTE_X &lt; MON_X + MON_W &amp;&amp; ABSOLUTE_Y &gt;=3D MON_Y &amp;&amp=
; ABSOLUTE_Y &lt; MON_Y + MON_H )); then<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 MONITOR_WIDTH=3D$MON_W<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 MONITOR_HEIGHT=3D$MON_H<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 MO=
NITOR_X=3D$MON_X<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 MONITOR_Y=3D$=
MON_Y<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 fi<br>=C2=A0 =C2=A0 fi<br>done &lt;&lt;&lt; &quot;$MONITOR_IN=
FO&quot;<br><br>HALF_WIDTH=3D$((MONITOR_WIDTH / 2))<br>HALF_HEIGHT=3D$((MON=
ITOR_HEIGHT / 2))<br><br>case $COMMAND in<br>=C2=A0 =C2=A0 -1)<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 xdotool windowmove &quot;$WINDOW_ID&quot; $MONITOR_X $=
((MONITOR_Y + HALF_HEIGHT))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 xdotool windowsi=
ze &quot;$WINDOW_ID&quot; $((HALF_WIDTH + WIDTH_FIX)) $((HALF_HEIGHT + HEIG=
HT_FIX))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ;;<br>=C2=A0 =C2=A0 -2)<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 xdotool windowmove &quot;$WINDOW_ID&quot; $MONITOR_X $=
((MONITOR_Y + HALF_HEIGHT))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 xdotool windowsi=
ze &quot;$WINDOW_ID&quot; $((MONITOR_WIDTH + WIDTH_FIX)) $((HALF_HEIGHT + H=
EIGHT_FIX))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ;;<br>=C2=A0 =C2=A0 -3)<br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 xdotool windowmove &quot;$WINDOW_ID&quot; $((MONIT=
OR_X + HALF_WIDTH)) $((MONITOR_Y + HALF_HEIGHT))<br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 xdotool windowsize &quot;$WINDOW_ID&quot; $((HALF_WIDTH + WIDTH_FIX)=
) $((HALF_HEIGHT + HEIGHT_FIX))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ;;<br>=C2=A0=
 =C2=A0 -4)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 xdotool windowmove &quot;$WINDOW=
_ID&quot; $MONITOR_X $MONITOR_Y<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 xdotool wind=
owsize &quot;$WINDOW_ID&quot; $((HALF_WIDTH + WIDTH_FIX)) $((MONITOR_HEIGHT=
 + HEIGHT_FIX))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ;;<br>=C2=A0 =C2=A0 -5)<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 xdotool windowmove &quot;$WINDOW_ID&quot; $MONI=
TOR_X $MONITOR_Y<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 xdotool windowsize &quot;$W=
INDOW_ID&quot; $((MONITOR_WIDTH + WIDTH_FIX)) $((MONITOR_HEIGHT + HEIGHT_FI=
X))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ;;<br>=C2=A0 =C2=A0 -6)<br>=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 xdotool windowmove &quot;$WINDOW_ID&quot; $((MONITOR_X + HAL=
F_WIDTH)) $MONITOR_Y<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 xdotool windowsize &quo=
t;$WINDOW_ID&quot; $((HALF_WIDTH + WIDTH_FIX)) $((MONITOR_HEIGHT + HEIGHT_F=
IX))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ;;<br>=C2=A0 =C2=A0 -7)<br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 xdotool windowmove &quot;$WINDOW_ID&quot; $MONITOR_X $MON=
ITOR_Y<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 xdotool windowsize &quot;$WINDOW_ID&q=
uot; $((HALF_WIDTH + WIDTH_FIX)) $((HALF_HEIGHT + HEIGHT_FIX))<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 ;;<br>=C2=A0 =C2=A0 -8)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 xdotool windowmove &quot;$WINDOW_ID&quot; $MONITOR_X $MONITOR_Y<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 xdotool windowsize &quot;$WINDOW_ID&quot; $((MONITOR_W=
IDTH + WIDTH_FIX)) $((HALF_HEIGHT + HEIGHT_FIX))<br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 ;;<br>=C2=A0 =C2=A0 -9)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 xdotool windo=
wmove &quot;$WINDOW_ID&quot; $((MONITOR_X + HALF_WIDTH)) $MONITOR_Y<br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 xdotool windowsize &quot;$WINDOW_ID&quot; $((HALF_=
WIDTH + WIDTH_FIX)) $((HALF_HEIGHT + HEIGHT_FIX))<br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 ;;<br>=C2=A0 =C2=A0 -g*)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 GEOM=3D&quot=
;${COMMAND:2}&quot; # strip &quot;-g&quot;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 I=
FS=3D&#39;,&#39; read -r GX GY GW GH &lt;&lt;&lt; &quot;$GEOM&quot;<br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 if [[ -n $GX &amp;&amp; -n $GY &amp;&amp; -n $GW &=
amp;&amp; -n $GH ]]; then<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 xdot=
ool windowmove &quot;$WINDOW_ID&quot; &quot;$GX&quot; &quot;$GY&quot;<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 xdotool windowsize &quot;$WINDOW_=
ID&quot; &quot;$((GW + WIDTH_FIX))&quot; &quot;$((GH + HEIGHT_FIX))&quot;<b=
r>=C2=A0 =C2=A0 =C2=A0 =C2=A0 else<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 echo &quot;Error: invalid geometry format. Use -gX,Y,W,H&quot;<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 exit 1<br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 fi<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ;;<br>=C2=A0 =C2=A0 *)<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 echo &quot;Error: Unknown command: $COMMAND&quot;<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 exit 1<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ;;<br>esa=
c<div><br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=
=3D"gmail_attr">On Wed, Sep 3, 2025 at 10:43=E2=80=AFAM Jack &lt;<a href=3D=
"mailto:[email protected]" target=3D"_blank">[email protected]</a>&gt; wr=
ote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px=
 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D=
"ltr"><div dir=3D"ltr">I have three monitors running six virtual desktops, =
all filled with applications some are tiled and some are floating. I&#39;m =
currently writing a script to manage them, but it&#39;s making me consider =
just switching to i3 :)</div><br><div class=3D"gmail_quote"><div dir=3D"ltr=
" class=3D"gmail_attr">On Wed, Sep 3, 2025 at 10:29=E2=80=AFAM killermoehre=
 &lt;<a href=3D"mailto:[email protected]" target=3D"_blank">killermoehre=
@gmx.net</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D=
"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-le=
ft:1ex"><p>Am Mittwoch, dem 03.09.2025 um 10:17 +0300 schrieb Jack:</p>
<blockquote type=3D"cite">
<p>Unfortunately, <strong>built-in commands cannot be used</strong> because=
 after using them, the window size can no longer be changed programmaticall=
y (ie. from the scripts). This is because if you switch to another desktop =
and then return, the window manager no longer correctly remembers the modif=
ied window sizes. This is precisely why I&#39;m creating my own script for =
this purpose.</p>
</blockquote>
<p>A really long time ago I wrote <a href=3D"https://github.com/killermoehr=
e/window-gridder" target=3D"_blank">https://github.com/killermoehre/window-=
gridder</a> for this purpose, but abondend it, because Xfwm4 hat inbuild wh=
at I need and it has problems with client side decorations.</p>
<p>You can use it at a starting point.</p>
<p>But IMHO it sounds like you want more of a tiling WM and not a floating =
one, right? Xfce allows to simply <em>replace</em> the current WM with anot=
her one. I wrote <a href=3D"https://wiki.xfce.org/howto/other_window_manage=
r" target=3D"_blank">https://wiki.xfce.org/howto/other_window_manager</a> f=
or this.</p>
_______________________________________________<br>
Xfce mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a><br>
<a href=3D"https://mail.xfce.org/mailman/listinfo/xfce" rel=3D"noreferrer" =
target=3D"_blank">https://mail.xfce.org/mailman/listinfo/xfce</a><br>
<a href=3D"http://www.xfce.org" rel=3D"noreferrer" target=3D"_blank">http:/=
/www.xfce.org</a><br>
</blockquote></div></div>
</blockquote></div>
</blockquote></div>

--00000000000098ec80063de88bf1--

--===============8167815639117674377==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Xfce mailing list
[email protected]
https://mail.xfce.org/mailman/listinfo/xfce
http://www.xfce.org

--===============8167815639117674377==--