Hi!
It seems Alt+Tab is a hot topic now
Anyway, this is one of the few things I never managed to get exactly they way I like. I want some behaviour similar to FAQ 3.3, i.e. If I’m in window A and cycle to window B, the next time I press Alt+Tab I want to come back to window A. But I want to do this without using the window list, I want the windows rising as I cycle through them.
The most natural way to do this (I think) would be to bind the update of the window list to the release of the alt key, but this is not possible at the moment AFAIK. The solution I came up with works like this (BTW, I speak about Alt+Tab, but for my config it is Super+Tab):
Key Super_L A A SetEnv FVWMFirstAltTab YES
Key Tab A 3 AltTab
DestroyFunc AltTab
AddToFunc AltTab
+ I PipeRead 'if [ "$$FVWMFirstAltTab" != "NO" ]; then \
echo FirstAltTab; \
else \
echo NthAltTab; \
fi'
+ I SetEnv FVWMFirstAltTab NO
DestroyFunc FocusAltTab
AddToFunc FocusAltTab
+ I FlipFocus
+ I Raise
DestroyFunc FocusFirstAltTab
AddToFunc FocusFirstAltTab
+ I FocusAltTab
+ I State 15 Off
+ I WindowId $0 State 15 On
DestroyFunc FirstAltTab
AddToFunc FirstAltTab
+ I Current (State 15) NthAltTab
+ I TestRc (NoMatch) Next (CurrentPage, State 15, !Iconic, !Shaded, !Sticky, AcceptsFocus) FocusFirstAltTab $[w.id]
+ I TestRc (NoMatch) Next (CurrentPage, !Iconic, !Shaded, !Sticky, AcceptsFocus) FocusFirstAltTab $[w.id]
DestroyFunc NthAltTab
AddToFunc NthAltTab
+ I Next (CurrentPage, !Iconic, !Shaded, !Sticky, AcceptsFocus) FocusAltTab
Here’s how the code works: In each Super+Tab cycle, I mark the window I started from (thus the window I would like to return to with the next Super+Tab) with state 15. When pressing Super+Tab, if it is the first time I press the key combination I jump to the window with State 15. If it is the second or greater time (without releasing Super_L) I continue cycling through the window ring.
How do I differentiate the first time I press Super+Tab? I use the trick of binding a function to Super_L and also using it as a modifier. If I press Super_L the env. variable FVWMFirstAltTab gets set to YES. If tab is pressed the function AltTab gets called, which sets FVWMFirstAltTab to NO, so I can distinguish the first and subsequent calls to AltTab.
Now comes the question part: Is this method reliable or it is possible that it stops working in future releases? And this gets a bit messed up if I change the focus with other methods e.g. with the mouse (therefore the first test in FirstAltTab). Any ideas how to solve it? I though about using FvwmEvent, but I expect it to interfere with the above code and I’m not sure how to solve it. Has anybody found a better solution?
Regards.