How focused window name in FvwmButton?

You would use the ChangeButton directive in FvwmButtons along with FvwmEvent.

First of all you’d want to tell FVWM to track focused windows – use either focus_change or enter_window for that. We’ll go with enter_window since it’s more robust.

DestroyModuleConfig FE-TB:*
*FE-TB: Cmd Function
*FE-TB: enter_window TitleFB

Module FvwmEvent FE-TB

Then for FvwmButtons:

DestroyModuleConfig FB:*
*FB: Rows x
*FB: Column y
*FB: (1x1, Id "TitleB", Title "No Window")

Module FvwmButtons

As for the function which does all the hard work…

DestroyFunc TitleFB
AddToFunc    TitleFB
+ I Current SendToModule FB ChangeButton TitleB Title $[w.name]

– Thomas Adam

Thomas, nice one!

Working like a … hmm what’s a thing just below charm?
Because I’m using a ClickToFocus in my config, the focus_change was for me, but I just found a little annoyance with the whole thing. The title updates itself only when focus is changed. To get me right, say… with a web browser when you browse to another page, the button created to show the title doesn’t obviously update itself because the focus remains on the same window.

…And at the same time as a was going to ask the real question, I just figured that adding window_name (or icon_name?) to FE-TB does what I wanted.

[code]DestroyModuleConfig FE-TB:*
*FE-TB: Cmd Function
*FE-TB: focus_change TitleFB # BETTER FOR CLICKTOFOCUS
*FE-TB: window_name TitleFB # ADDED THIS ONE

Module FvwmEvent FE-TB[/code]
Is that the correct way to do it, or can someone suggest a better one? Also, is there a difference in this case whether you use window_name or icon_name?
(hmm… After testing it a few times, restarting FVWM with a few windows open gives me Desk 0 to the title button and it doesn’t change until focus or title has changed. Should there be a “wait for all of the windows to be drawn” in some place?)

Anyway, the whole thing seems like a nice way to “detatch” the titlebar :slight_smile:

Sakari

Possibly.

What was it you expected with something called focus_change? focus_psychic?

So see the string attribute of FvwmEvent – and look on these forums, I’ll have mentioned it before.

See above.

– Thomas Adam

Should have I NOT said that?

Read below…

Maybe I should’ve shouted the OBVIOUS part of the sentence?

And all the blahblah for just to say that? – and I’ve done that, but didn’t know what to look for until now.

Saw it, got it.

I mean, no offence Thomas, take a break… It took you 4(?!) minutes to reply and all you said in this post was “look for the string”. Oh well, I’ll do that…

You’ve missed my point – “string” is an FvwmEvent which will react whenever a window’s title changes, that I can tell. This is irrespective of things like focus change. So try it and see. As in:

*Whatever: string doSomething with $[w.title]

I know I have spoke of this before on these forums, which is all I meant when I said search them if you get stuck, I generally try and avoid repeating myself since it can get tedious at times.

– Thomas Adam

@Thomas, sorry for the harsh words…

Still haven’t moved an inch towards my goal though. Just to clarify what I’m after, here’s a screenshot.

Hmm? The following ought to work:


DestroyModuleConfig FB:*
*FB: (1x1, Id "mybutton", Title "Testing...")

KillModule FvwmButtons FB
Module FvwmButtons FB

DestroyModuleConfig FE:*
*FE: Cmd Function
*FE: string TitleButton
*FE: focus_change TitleButton

DestroyFunc TitleButton
AddToFunc   TitleButton
+ I SendToModule FB ChangeButton mybutton Title $[w.name]

KillModule FvwmEvent FE
Module FvwmEvent FE

It’s almost exactly the same as the other examples I’ve posted here – it’s not clear from your screenshot what functionality you’re after based on the example in this message.

– Thomas Adam

So it seems… And it does the same job too :slight_smile: though I’m still don’t know what the string attribute is supposed to do? To update the title of “mybutton” when I don’t change focused window (when loading a new page in web browser etc) I still have to use the window_name attribute.

Sorry about that. I just had an idea to make a “universal titlebar” with FvwmButtons. Once the basic structure of it is clear and functional, one could easily make it to be sort of a mixture of a panel and a titlebar to make it more useful (which was the idea in the 1st screenshot).
At the moment I’m puzzled with how to clear that “title button” when a desktop is empty and how to make it ignore certain windows (like the one’s that are skipped from windowlist etc.), but I’ll keep on searching and tweaking.
Here’s a cleaner shot where X is close, _ is iconify and O is maximize, and nothing extra. I hope that clears it up?

Oh, and If there is another, simpler (or less resource hungry?) way to achieve this, please tell me :slight_smile:

You could just set a State on those windows you don’t care about and then do:

+ I Current (State x) SendToModule ...

– Thomas Adam

Yiep, that’s what I figured and it got me a bit further. I’ll probably be back with more questions soon. Thanks again.