how to query the existance of windows on another desktop?

If I’m on desk 0, what’s the best way to (1) query if any window exists on desk x (where x is not the current desk) and (2) if a specific window is open on desk x?

So far, the only thing that I’ve got working is to set the equivalent state for each window (all windows on desk 1 have state 1 set, etc), but that seems somewhat wasteful since it uses up (in my case) 6 states.

It would be nice if there were a ‘desk n’ condition, but if such a thing exists, I haven’t found it.

–Flatline

All (!CurrentDesk) Echo "$[w.name] is on $[w.desk]"

Etc…

– Thomas Adam

So if I was on desk 0 and wanted to move to desk 2 if and only if desk 2 was non-empty I’d do something like:

AddToFunc GotoDeskIffNonEmpty
+ I All (!CurrentDesk, AcceptsFocus) PipeRead 'if [ $[w.desk] -eq $0 ]; then echo GotoDesk 0 $0; echo Break; else echo Nop'

Assuming, of course, the $0 is the target desk.

Maybe I’ll take a look at the code and see what’s required to add a ‘desk n’ condition since the following would be so much prettier:

AddToFunc GotoDeskIffNonEmpty
+ I Any (desk $0, AcceptsFocus) GotoDesk 0 $0

I’ve been meaning to look at fvwm’s source code for a while now anyway.

Thanks for you help. As always, your always prompt, always informative responses are greatly appreciated.

–Flatline

Pretty much that, yes. :)

It would not be a difficult thing to do – conditionals.c is all you would need to change as the struct (and hence the hints set on it) for which desk a window is on, already exists.

You’re welcome.

Thomas Adam.