Is wmctrl a good idea?

I came to fvwm from xfce where I missed a way for really using virtual desktops.
For that environment, I wrote a script called ozganizator (http://ozganizator.berlios.de) that used wmctrl and a bit of bash for ordering windows in desktops on a command. I mean, it sent, for example, terminals to desktop 1, web browsers to desktop 2… in a similar way as Afterstep does.

Of course, this can be much better done in fvwm, but I wanted to keep this functionality and also the configuration beetween several window managers 'cause I usually change for trying new ones.

Basically, I kept the configuration in files (d1, d2, d3, d4…) corresponding to each desktop configuration with just window names in each one. Then a little script like this:

[code]# just a counter
DESKTOP_C=0

for all desktops configured

until [ $DESKTOP_C -eq $N_DESKTOP ] ; do
DESKTOP_C=$(($DESKTOP_C+1))

for all windows configured in each desktop

    for i in $(cat d$DESKTOP_C) ; do

for all opened windows

            for j in $(wmctrl -x -l | grep $i | cut -d " " -f 1 ); do 

Send each window to each configured desktop

                    wmctrl -i -r $j -t $(($DESKTOP_C-1))  
            done
    done

done[/code]

wmctrl (http://www.sweb.cz/tripie/utils/wmctrl/) has many good features. Althought it’s really limited in comparison with fvwm, it’s quite portable beetween different window managers (EWMH specifications).

I wanted to know if you think it’s a good idea to keep using wmctrl for tasks it can do (like this one) so those tasks will be avaiable for other window managers, or should I code exclusively for fvwm and forget all my functions when trying other wm’s.

You don’t need this at all in FVWM.

If you wanted to send all xterms to desktop 1 then:

All (XTerm) MoveToDesk 1

If you wanted to do that for the current page, use:

All (XTerm, CurrentPage) MoveToDesk 1

etc.

– Thomas Adam

Shrugs – I wouldn’t bother. Keep the script as it is for other window managers, and use FVWM as it is meant to be without the superfluous stuff.

– Thomas Adam

Yes, I think that’ll be the best solution… Thanks.

wmctrl is ready for other wm user.