Move/GotoToDesk and Raise

Hi all!

I’m trying to be able to move a window to the next/previous desktop, goto that desktop and give the window the focus with a keybinding. I thought it should work like that:

[code]SetEnv NumDesks 5

Key Right A SM MoveWindowToDesk 1 0 $[NumDesks]
Key Left A SM MoveWindowToDesk -1 0 $[NumDesks]

DestroyFunc MoveWindowToDesk
AddToFunc MoveWindowToDesk

  • I MoveToDesk $0 0 $[NumDesks]
  • I Next (!Iconic !Shaded AcceptsFocus CurrentPage) FlipFocusRaise
  • I GotoDesk $0 0 $[NumDesks]
  • I Raise

DestroyFunc FlipFocusRaise
AddToFunc FlipFocusRaise

  • I FlipFocus
  • I Raise
  • I WarpToWindow 50 50[/code]
    This first moves the current window to the next/previous desktop, gives the next window on the current desk the focus (to leave the desktop with something focused), goes to the desktop the window has been moved to but does not raise it.

Maybe someone got an idea what’s wrong with that? I don’t get it working, even if I leave out the “Next (!Iconic !Shaded AcceptsFocus CurrentPage) FlipFocusRaise”-part and replace “+ I Raise” with “Focus”, “FlipFocusRaise” or something like that.

First thing I note here is that you’re just reproducing your efforts, and are not using the values you passed into the function. That first line, above really just wants to be:

+ I MoveToDesk $*

You should be using commas, to separate out the functionality of the conditions:

+ I Next (!Iconic, !Shaded, AcceptsFocus, CurrentPage) FlipFocusRaise

… and again, below, remember “$*”

+ I GotoDesk $*

That’s because you want to use the “Prev” command.

– Thomas Adam

Thanks for pointing this out, this was of course a mistake. Note to self: Don’t try to be productive at one o’clock in the morning.

Ok, I didn’t know that the conditions should be separated by commas, but I’ll remember that.

I think you mean I should do it this way:+ I Prev Raise But that does not work either, maybe I’m missing something? Please forgive me if this sounds stupid or something, but I’m pretty new to Fvwm. Even though I got almost everything working like it should this one thing is driving me crazy.
If I understand the docs correctly this should do what I want:[code]DestroyFunc MoveWindowToDesk
AddToFunc MoveWindowToDesk

  • I MoveToDesk $0 0 5
  • I GotoDesk $0 0 5
  • I Raise[/code]
    Where $0 is -1 or +1 for the previous resp. next desktop. I don’t even understand why I should replace “Raise” with “Prev Raise”, this just does not make sense to me.