Changing a pixmap for a buttonstyle

A quick question if this is possible. I use pixmaps as decorations for my titlebar buttons. Here is an example line:

+ AddButtonStyle 2 Inactive (Pixmap window/close.png -- flat)

I want to be able to change this pixmap on the fly via FvwmCommand.

I tried this by adding the pixmap to a new colorset (knowing I can change this on the fly), and add the new colorset as the buttonstyle. The colorset applied fine, but the problem is that the background of the colorset doesn’t match the titlebar area.

This is the titlebar colorset:

Colorset 7 fg black, bg white, sh white, RootTransparent Buffer, Tint #f6f6f6 20

This was the new colorset I added:

Colorset 1313 Pixmap /home/mikeg/.fvwm/pixmaps/icons/aim.png

I also tried this:

Colorset 7 fg black, bg white, sh white, RootTransparent Buffer, Tint #f6f6f6 20, Pixmap /home/mikeg/.fvwm/pixmaps/icons/aim.png

Is it possible to do this via a colorset, and if not, is it possible to change the buttonstyles directly with FvwmCommand?

[color=red]Edited by theBlackDragon:
–> moved from General questions: I suspect this belongs more in the Decorations and bindings forum.[/color]

Then you want to do something like this:

ButtonStyle 4 Pixmap ...

Then you can do things like:

Style * !Button2, Button 4

Which toggles button 2 for button 4, and given that they’re both adjacent to one another makes life easier.

Of course, via FvwmCommand is easy. You just issue those commands above as you see fit through it.

– Thomas Adam

I’m having a few problems still, probably because I don’t understand FvwmCommand very well.

I take it from what you wrote, that I can create a new button style like so:

FvwmCommand "ButtonStyle 8 Pixmap test.png"It seems like this command never does anything.

I run this to hopefully swap the pixmap I have just defined in button 8 with button 4:

FvwmCommand "Style * !Button4, Button 8"This causes button 4 to disappear.

I’ve tried a bunch of differnet combinations, but no luck. What am I doing wrong?

It does nothing more than send commands to FVWM via a named pipe.

It wouldn’t do, unless you told the window to use that button. You could go down the route of just defining two decors, and then using ChangeDeor to switch between them, however doing that would probably be completely overkill.

Well, it’s doing what you’re asking of it, of course. I assumed that’s what you were trying to do. If not, see the following:


– Thomas Adam

I think I actually do need to create a new decor and then change it via fvwmcommand. If I create a second decor this command will change it.

FvwmCommand "Style * UseDecor DefaultDecor2"

It seems that the only limitation is that I need to specify the decors ahead of time (since I’m not sure how to actually create a new decor via fvwmcommand), but this should be fine for my purpose.

Thanks Thomas!

You don’t have to do it ahead of time, you could just build it up, echo it to a file, and use FvwmCommand to issue a Read command to the file.

– Thomas Adam

Very cool… I forgot about Read. I verified it, and it works:

FvwmCommand "Read /path/to/decortest" FvwmCommand "Style * UseDecor DefaultDecor3"

decortest contains the new decor (ie. DefaultDecor3).

You can condense this down further:

(echo "Read /some/file"; echo 'Style * UseDecor DefaultDecor3') | FvwmCommand -c

– Thomas Adam