'Next' conditional command

Hi Everyone,

Im trying to write something that would cycle through all the windows on the current page. Sort of like built-in WindowList, but without the menu, and that would cycle through each window on the current page before returning to the first window. I’m using the conditional ‘Next’ and ‘Prev’ commands. As FVWM manual says, all the windows are kept in a ‘ring-like’ structure, and searching starting from the current window will cycle through all the windows with some specified condition. So doing ‘Next (CurrentPage) FlipFocus’ should be enough to cycle through all the pages on current desk. Here’s the full code:

DestroyFunc NextWindow
AddToFunc NextWindow
 + I Next (CurrentPage) FlipFocus

DestroyFunc PrevWindow
AddToFunc PrevWindow
 + I Prev (CurrentPage) FlipFocus

Key M A M NextWindow
Key N A M PrevWindow

However, as written this does not work. If there are two windows on a page, only one shortcut works (Alt-N one, with ‘Prev’ command), the other doesn’t do anything. If there are more windows, it depends on which of them were focused before this is executed.
Sometimes only one window is selected, sometimes it cycles between two windows and leaves others out. Could anyone point to me why the above doesn’t work and which part of documentation I’m reading incorrectly?
Thank you.

Next starts looking on the focused window if it has no context, so either you will have to use Next (CurrentPage, !Focused) or Next Next (CurrentPager).

This has been part of the cookbook for years now:

starshine.org/xteddy/thomas/fvwm … q.html#WC2

– Thomas Adam

Hi,

Thank you for answering. I didn’t know of the existence of FVWM Cookbook and the Wiki, they seem to contain abundance of useful information. I found that my initial code didn’t work because I didn’t set some windows, such as the pager and the clock, to CirculateSkip style. Once I did that and used !Focused suggested by Gramphos, my config almost worked, only FlipFocus should be replaced by Focus and Raise. So the code below does exactly what I want - cycle through the windows in backward and forward directions:

DestroyFunc FocusRaiseWindow
AddToFunc FocusRaiseWindow
+ I Iconify off
+ I Focus
+ I Raise
DestroyFunc NextWindow
AddToFunc NextWindow
+ I Next (CurrentPage, !Focused) FocusRaiseWindow
DestroyFunc PrevWindow
AddToFunc PrevWindow
+ I Prev (CurrentPage, !Focused) FocusRaiseWindow
Key M A MC NextWindow
Key N A MC PrevWindow

Thank you again.