[Settings menu] - On the fly - (Solved)

I’m making a menu to change some settings on the fly. For now I have working so far the colorsets and wallpapers menu. The decos one is failing (the change is only efective after a restart) but I will solve that later.

My question now is about timing. The two menus are working, mostly, but sometimes I get a message like this in the vt:

[FVWM][Read]: <<ERROR>> 'file /home/i92guboj/.fvwm/colorsets/.colorset' not found

It is obvious what does that mean, this is the function that I use to do the thing:

DestroyFunc user_ChangeColorset
AddToFunc   user_ChangeColorset
+ I Exec rm -f $[fvwm_colorsets]/.colorset
+ Exec ln -s $0 $[fvwm_colorsets]/.colorset
+ Read $[fvwm_colorsets]/.colorset
+ Refresh

That works. The problem is that works sometimes. It is a timing problem. Sometimes rm does its job but ln comes before the changes are writing and is ln who complain about that .colorset being there (so it cant create the link and I end with no colorset at all loaded but the default greys), other times is Read who complain about the link not being there, after rm and ln have done their jobs. And another times (most of them) the thing just works.

I lookid into some config and searched around but cant figure out this for myself. I tried scheduling the tasks 1 sec, but it does not work either. I could schedule them 5 secs, but then better put a Restart at the end of the function instead of a Refresh…

Any idea of what am I forgetting?

  • Thanks in advance for any help :wink:

Ok, to answer myself: I saw this in the man:

 The PipeRead command executes synchronously.   If  you  want  to
              Exec  something,  but need the command to run synchronously, you
              might do something like:

                   PipeRead 'command 1>&2'

So I went and did:

DestroyFunc user_ChangeColorset
AddToFunc   user_ChangeColorset
+ I Piperead 'rm -f $[fvwm_colorsets]/.colorset'
+ I Piperead 'ln -s $0 $[fvwm_colorsets]/.colorset'
+ I Read $[fvwm_colorsets]/.colorset
+ I Refresh

For now, all seems to work so far. Someone more iliterated than me in fvwm, can you confirm if this is a good way to do this? If it is then I will put solved in the title of the topic :wink:

  • Thanks in advance.

[EDIT]: Slightly offtopic, but, about the Decorations, I do this:

DestroyFunc user_ChangeDecoration
AddToFunc   user_ChangeDecoration
+ I Piperead 'rm -f $[fvwm_decorations]/.decoration'
+ I Piperead 'ln -sf $0 $[fvwm_decorations]/.decoration'
+ I Read $[fvwm_decorations]/.decoration
+ I Restart 

Any chance to update all the decos without having to restart? I dont care, that is fine, just curious to know if there is, indeed, another way to go.

Are these being applied to a window, or windows?

Style * UseDecor foo


– Thomas Adam

To all windows, globally. The fact is that I use that code but the style does not apply, I need to restart. The decos is something like:

DestroyDecor Decoration
AddToDecor   Decoration

<insert whatever stuff here>

Style * UseDecor Decoration

In adiction, I repeat that in the function that changes the deco:

DestroyFunc user_ChangeDecoration
AddToFunc   user_ChangeDecoration
+ I Piperead 'rm -f $[fvwm_decorations]/.decoration'
+ I Piperead 'ln -sf $0 $[fvwm_decorations]/.decoration'
+ I Read $[fvwm_decorations]/.decoration
+ I Style * UseDecor Decoration

The link is updated, all is fine, if I change the last line (the Style one) with + I Restart, fvwm restarts and load the decoration fine. But the way that the function is there, the deco loads but does not show. No error appear in the vt either…

Instead, the default decoration is shown each time that I try to change it. The decoration is loaded, im sure because if I open a new window it uses the new decoration, but the windows that are already open are shown with the default fvwm decoration.


+ I UpdateStyles

… to your function with the Style line in it.

– Thomas Adam

Before all, thanks for all the replies Thomas.

This is somewhat strange. My different styles do have different heights for the tittlebar and that setting indeed changes when I do all the modifications and select the deco from the menu. But the vectors in the buttons does not show, and they are no more flat when I pick any style (until I restart).

I will take a closer look to the decos, there might be something simple that I am missing here… :confused:

Possibly. Decor definitions are classed as destructive or partially-destructive, depending on what you’re using, and how they’re being applied. For me, changing decors in the manner I’ve specified has never been a problem. It has just worked.

– Thomas Adam