WarpToWindow from icon or non-icon


Moderators: This is a continuation of the topic found here:
http://fvwm.lair.be/viewtopic.php?t=677 But I didn’t know how to move it, and didn’t want to post this in the wrong forum so… if someone wants to move the whole thread, feel free.

So, I have been working on writing complex functions, and wanted a function that could warp into focus an appplication/window (Thanks, Thomas Adam)

Now, the change that I want to make is if this application is iconified, it will be maximized and then warped to the front (brought into focus).

If the application “foo” is not iconified, it will simply be warped to the front (into focus).-- All of this is currently being done on the same desk - my end goal is to be able to call this function and have it warp me to the desk where this specific application would be running – and bring it to the front of it’s desk (into focus) — but that is for the next iteration…

Anyway, here’s the NON-WORKING code I wrote to try and warp to the front an application ‘foo’ whether or not it is currently iconified:

[code]DestroyFunc FuncMyWarpToFocusRegardLessOfIconifiedState
AddToFunc FuncMyWarpToFocusRegardlessOfIconifiedState

  • I FocusOnWindow “foo

    DestroyFunc FocusOnWindow
    AddToFunc FocusOnWindow

    • I None ($$0, Iconic) ThisWindow($$0) DeIconifyAndWarp $$0
    • I TestRc (Match) Break
    • I None ($$0, !Iconic) ThisWindow($$0) WarpToWindow 50 50

    DestroyFunc DeIconifyAndWarp
    AddToFunc DeIconifyAndWarp

    • I Iconify
    • I WarpToWindow 50 50

I thought that this would work, from what I have read and what I have been told on the forum… but it is apparent that I am STILL missing something about the syntax/semantics of something even this simple.

Any comments/ideas/mocking laughter are welcome :slight_smile:


[color=red]Edited by theBlackDragon:
–> Unfortunately phpBB doesn’t allow for thread to be merged by default, I’ll have to look into that someday, I move the other one to General configuration questions instead, unless people disagree and think it belongs here.[/color]

I found a solution to bringing into focus an application, whether it is initially iconified or not.

if you guys could look at it and give me any pointers on style/syntax/etc. I would really appreciate it.

DestroyFunc FuncMyWarpToFocusRegardlessOfIconifiedState
AddToFunc FuncMyWarpToFocusRegardlessOfIconifiedState

  • I FocusOnWindow “foo

    Helper function

    DestroyFunc FocusOnWindow
    AddToFunc FocusOnWindow

    • I Next ($$0, CirculateHit) Function MakeVisible
    • I TestRc (Match) Break

    Helper function

    AddToFunc MakeVisible

    • I GoToDesk 0
    • I Raise
    • I Iconify off
    • I WindowShade off
    • I Focus[/code]

Thanks in advance,

I’ve mentioned this to you before about the (over) use of wildcards. Take heed, and watch for (possible) unwanted results.

The last line in this function is superfluous. Think about it. There’s only the first line which does any work – and as the seconf line just breaks from the function, you don’t need it. The first line is guaranteed to run, anyway.

– Thomas Adam

good pont on the lack of need for the TestRc… I’ll remove that and keep it in mind.

I have also removed the wildcards from my code where I know the specific name of the object I want executed/brought into focus/etc.

Thanks for all your help,