windowId and WarpToFunction

Hi,

I want to be able to use the Conditional command WindowId. I have looked through the FVWM man page and can’t find out how to know what the id of a window is.
The man page has an example:

WindowId root 1 WarpToWindow 50 50

Which (as I understand) warps to the window with window Id of ‘root’, but how do I know what those window id’s are? is it something I assign as a style?

[color=red]Edited by theBlackDragon:
–> Well, this is no basic question, but most of this thread isn’t about Complex functions either, so moving from Basic question, the continuation of this thread in Complex Functions is here[/color].

man FvwmIdent will tell you how to get to know it and no, you can’t assign a window id yourself.

No – whenever a window is mapped (created) to the Xserver, the window is given a unique ID. This is usually represented hexadecimally, and you can use FvwmIdent to ascertain it, along with the program: xwininfo and even xprop.

However, interactivally, what you can do is something like this:

WindowId $[w.id] something_that_happens

Assuming the window was currently focused. Using the FVWM command ‘WindowId’ is quite specific though – what makes you think you need to use it; and more importantly, what is it that you’re trying to do?

– Thomas Adam

Thomas –

I want to have a function that gets called at a button press, and when that function gets called, I want to have a target window (which is already running) brought to the front, in focus - kind of like having a default window that you want to have available at the touch of a button.

I thought that this might be possible using WindowId, so that is why I’m asking…

Thanks,
Skender

Ah, I see. Well, yes, you could use WindowId, although, you’d be better off using the window’s title or class:

[code]
DestroyFunc FuncWarpFocus
AddToFunc FuncWarpFocus

  • I All (CurrentDesk, !Iconic, AcceptsFocus) ThisWindow (some_name) WarpToWindow …[/code]

– Thomas Adam

That should work perfectly.

I’ll put that in and see what kind of results I get.

Thanks again Thomas –
Skender

Thomas –

The code you gave me worked really well… Thanks.

So, I tried extending the function to work with a *.c file that I wrote that needs to be ‘minimized and an icon’ (according to the docs) on the desk when it is started, so I used the following line of code in my StartFunction

 + I Exec bash -c 'path/foo -geometry XxY+0+0 -iconic'

And it works fine… the application is minimized and available in my task tray, as well as available in the desk.

So, here’s my problem, I tried to make the code you shared with me work if the window that I want to warp into focus is one of these minimized/iconified applications – and have the function maximize/de-iconify the application when WarpToWindow is called. Here is the code I tried:

+ I All (CurrentDesk, Iconic, AcceptsFocus) ThisWindow (Foo) WarpToWindow 50 50

And it just warped my icon to the front :-)…

Is it possible for me to use ResizeMaximize command in conjunction with the above code? I have tried appending it to the end, with no success, ala: WarpToWindow 50 50 ResizeMaximize 100 100 but that didn’t work.

Is it not possible to append a ‘window movement and placement’ command on the end of a WarpTowindow call?

Thanks for all your help,
Skender

A few things here. It’s nice this .c file application allows for an “-iconic” flag – and if it didn’t, there’s always the “StartsIconic” style option.

There’s nothing wrong with your code line above, but it’s a little “archaic” – I haven’t used the construct since Fvwm 1.x. Let FVWM spawn the process in its own login shell:

 + I Exec exec /path/foo -geometry XxY+0+0 -iconic'

Well, yes, it would do. What you therefore want to do is have a function called on the window when it is iconic, and toggle it:

[code]+ I All (CurrentDesk, Iconic, AcceptsFocus) ThisWindow (Foo) SomeFunc Foo

DestroyFunc SomeFunc
AddToFunc SomeFunc

  • I Iconify
  • I WarpToWindow 50 50
    [/code]

It harps back to your other question you asked, about complex functions. What I have written above is such a function. Things have to happen in a given order, it’s a logical process of events that take place on a window or windows. Yes, you can use ResizeMaximize on the window, although logically, you ought to WarpToWindow after you resize, else you’ll get odd results. Hence:

DestroyFunc SomeFunc
AddToFunc SomeFunc
+ I Iconify
+ I ResizeMaximize 100 100
+ I WarpToWindow 50 50

No, since the WarpToWindow is not conditional, or cyclic – it just performs one task, and one task only. The chaning of events like this is when a function is needed.

You’re welcome.

– Thomas Adam