[SOLVED] dynamicly change titlebar button.


This is what I would like to do, but I don’t know if it’s possible.
I will write a gaim plugin that will set a variable like $MESSAGE_RECEIVED to true when I get a new message and to false after I answerd the message.
I would like to make a titlebar button that reads this variable every x seconds and changes when the state of the variable is changed.

is this possible? and how? because I don’t really have an idea how to do it, but if I could include this, my config would be just perfect :slight_smile:

“Titlebar button”? Surely you mean you’d want the state of the variable to update itself which is subsequently displayed in the title of the window? If that’s so you might be able to use xprop(1) to set the WM_NAME XAtom of the window…

– Thomas Adam

That is not what I want.

Now every window has a close, maximize and minimize button. I want to add a 4th button. But this button should update itself every x seconds depending on a variable.
(I could set two vectors, one for true and one for false)

The idea I have is this: my gaim is swallowed in fvwmbuttons that I hide with a shortcut, so I don’t see when someone is talking to me. But if I could add this button to the titlebar of every window open then I could see when someone talks to me.
I have thought about other notifications but I don’t want it to take any space on my desktop so the titlebar is the only location where it should be.

(and a little other question… would it be possible to write a program that adds the time-date to every titlebar with something like xprop?)

You’d have to have two decor definitions, and then use something like:

Next (foo, bar, baz) ChangeDecor $[some_decor_name]

For some windows, yes.

– Thomas Adam

Ok, this might work but I have a problem with it,

when I do ChangeDecor on everything my swallowed application (in fvwmbuttons) disappear.

This is the code I use to changedecor

+ I All (*) ChangeDecor OtherDecor

can I solve this?

Well, yes it would do. How can you expect to change its titlebar button if it’s in FvwmButtons? Unless of course you mean all window which aren’t swallowed?

You need to restate a little more clearly just what you want to do…

– Thomas Adam

I would want to change the decor of all not swallowed windows.
Is there an easy way to do this?

I cant help with your button problem but heres a LINK that will help you with adding things to the title bar. Have you posted your config yet? Sounds interesting.

as soon as it is completly finished I will post it, but it ain’t finished yet :slight_smile:

first I really need to find out how I’m gonna change the decor of only the not swallowed apps.

If you have two unused buttons on one side you may define them as two separate buttons to use, assign them some Mouse binding (Nop) and then turn them on/off with the Button style.

I have allready some more information on what I want. But I have still a problem and will explain that some more here.

I’m looking for a way to change the decor of all the applications except those swallowed in fvwmbuttons.
Is that possible in any way?

I thus need to find a way to select only the not swallowed items.

Thanks for all the help

I don’t think there’s an easy way to figure out if an application is swallowed, you could list the swallowed applications’ names explicitly in the condition of course, or search for something that checks if a window has a titlebar and use that…

I tried to do it like this:

+ I All (!NoTitle) ChangeDecor blabla

(I used !NoTitle because Title doesn’t seem to work)

But my swallowed apps don’t show up after the changedecor :confused:
maybe it’s an other problem???

It’s strange because I can’t find none of the applications back, also fvwmpager is swallowed and it’s gone too.

any ideas?

That’s because you can’t use a condition !NoTitle. There is a “HasTitle” patch you can find here:


Mind you, if you set a style condition for FvwmButtons and FvwmPager for ‘CirculateSkip’, then you can do:

All (CirculateSkip, foo) bar

– Thomas Adam

I still beieve that using an extra decor for having one button to update is unneccessarily complex.

You say you already have 3 buttons. That mean that you have at least two buttons on the same side available. For the scope of this post I take it that the buttons should be on the right side of the title bar as close to the middle as possible.

Just add both buttons:

ButtonStyle 8 10 40x20@4 60x20@1 55x60@0 45x60@0 40x20@1 45x75@4 55x75@1 55x85@0 45x85@0 45x75@1 
ButtonStyle 6 16 30x30@4 40x20@1 60x20@1 70x30@1 60x40@0 55x60@0 45x60@0 45x40@1 45x35@1 40x25@0 30x30@1 45x75@4 55x75@1 55x85@0 45x85@0 45x75@1
Mouse 1 8 A Nop

Then disable the button you don’t want by default:

Style * !Button 8

And instead of doing a ChangeDeocor/UseDecor just do

Style * Button 8, !Button 6


Style * !Button 8, Button 6

And to change just one window use WindowStyle.

I use Sticky to do it, so now it works!

+ I (!Sticky) ChangeDecor ....

Only one more question:

is it a big difference if I use ChangeDecor or only change the buttons (as said in a post in this thread), I mean in cpu usage.

[color=red]Edit another little question:[/color]
Is fvwm smart enough to see if the decor it is changing to is the same as the current decor or should I check that myself to save some cpu?

I believe the biggest difference is the memory usage of having two decors defined rather than only one. I’m not sure about the cpu time for chaning decor verses hiding/showing a button.

I belive fvwm won’t know if you try to change to the current decor.

Thanks everyone for all your answers!

As soon as I have written the gaim plugin and get everything working I will post my config (it won’t be for the first week though to much work for school)