Setting title bar style according to title text

Hi

I can use Style “text” … in order to set the title bar style for windows having a certain text in the title bar, but after changing the title bar text in run-time (using xterm’s escape sequences, for example) FVWM will not change the title bar style accordingly.

My guess is that the style is applied when the window is created.

Is there a way to give FVWM “a hint” to make it know the title has changed?
Or maybe have FVWM periodically check?

tia,
Calius

Correct.

You can use FvwmEvent for this, listening on the “visible_name” event. Unfortunately, issuing a prior command to ensure a Style line previously set is issued, is slightly stupid. You can’t use a “Recapture” command because that gets you into a repetitive loop. Hence I suspect you want something like this:

DestroyModuleConfig FE: *
*FE: PassId
*FE: Cmd Function
*FE: visible_name FuncRetitle

Module FvwmEvent FE

DestroyFunc FuncRetitle
AddToFunc   FuncRetitle
+ I WindowId $0 (some_title) WindowStyle !Title, Sticky
+ I UpdateStyles

You might also want in the function a few TestRc commands which negate certain conditions, etc. But that’s the basics of it.

– Thomas Adam

Thanks Thomas!

First of all the quick reply and taking time, and then for the fact that it works :slight_smile:

I tried reading the docs for FvwmEvent, but can’t figure out the meaning of “Cmd”, and also what should I do if I want PassId for some events, and don’t want it for others? Should I start 2 instances? I’m asking for the sake of understanding – it works fine now, as I said. I am just not clear as to the semantics of FvwmEvent.

I should also point the obvious: I “got by” writing my config file by reading whatever I need to do the job, no more. I feel the need to learn more: what is recommended reading? eg: FvwmScript? Specific modules?

Finally, I am unclear what you meant by “issuing…” – is this the necessity of issuing the explicit “style” outside of FuncRetitle, in order for it to work “the first time”, when the window is created?

Thanks again,
Calius

Always a bonus.

OK, let’s see if I can clear some of it up for you. The use of “Cmd” in this instance is somewhat superfluous since the action you tell it to run on an event is either going to be assumed to be a Function or a Module – FVWM will search for it in that order if it doesn’t recognise it as a command. I told the module alias “FE” that for the actions it were listening on, the command (Cmd) was a function call.

Indeed, the use of “Cmd” really helps if you’re wanting to play sound events via it – wherein you can tell FvwmEvent to play “rplay” as its command.

As for the use of “PassId” – all that means is that if you’re in a function, the window id of the command is sent to it. Hence, in the function when you see:

 + I WindowId $0 (some_name) ...

What’s happening here is that when the window concerned with the “visible_name” event is acted up, the window Id is passed to the function, which “$0” expands. It’s harmless, and is only useful if you plan to use it. If not, you can ignore it.

What is it you need to know? I’m desperately trying to improve the documentation for FVWM – both in terms of the wiki. But the sad truth is, at the moment, the best documentation is here at the forums – if you use the search feature of it.

By all means keep the style line as you have it. What I mean when I say “issue” is that for order for the specific style line to apply, the window manager has to be told that the window has changed. There’s a few ways you can do this – indeed, the ‘Recapture’ command is what I’d use, but it’s not going to hel much here that I can see, given that because of the event you’re listening on, it’ll just get stuck in an endless loop. So, WindowStyle seems like the better option here – since that (ironically enough) just applies to that specific window.

Does that help?

– Thomas Adam

Hello again

As for the meaning of “Cmd” – I think I have it. It says whether the actions I specify are functions, modules, or sound files. What got me confused (and is still weird IMHO) is that it’s per module, not per command.

That’s also the reason for my original question regarding WindowId: I got what it does, but it was weird that this configuration was module-wide and not per-command. That’s why I asked about the 2 instances.

The documentation for FVWM – I cannot complain at all: there is no doubt much work has gone into the project in general and the documentation in particular. For me, it was hard to just read thru the man page without an introduction section of sorts, explaining what each “thing” is (what is a style, what can it apply to, what is an icon, etc.).

But again – I can’t complain. If I want the “complicated stuff” I’ll either put enough time into reading and re-reading the docs, or rely on the kindness of people in the forums.

Finally, re Recapture: the docs says it’s obselete and should not be used. Also says the visual effect is “disturbing”. I understand why it would help, not sure why it would cause an endless loop (is that because Recapture would trigger visible_name? If so – couldn’t you get around the recursion by using an Env variable to say “this has already happened once”?).

Cheers,
Calius

viewtopic.php?t=1425

Indeed.

Nope – you need to kill the FvwmEvent instance.

– Thomas Adam