"Constructor" and "Destructor"

Hi,

i’m looking for a method to run a fvwm function before I move a window and after I move a window:

[code]DestroyFunc MyFunc
AddToFunc MyFunc

  • I PreMove
  • M Move
  • I PostMove[/code]

The background is that I want to make the window transparent when moving. Maybe someone has another, better idea to implement this gimmick :slight_smile:

Regards,
D.Morlock

You’ve actually answered your own question in many respects, although you’re going to run into a problem. The concept of “before” and “after” an action within a function is a known concept – and something I have documented extensively on the fvwmwiki about synchronisation. You can read a little bit about it here:

starshine.org/xteddy/thomas/~n6t … fhobia.txt

You might find yourself in a timing issue, but by all means try some of the suggestions therein. Note that because of the way functions work in FVWM, they grab the pointer which means performing operations pre and post on a window is something of a misnomer anyway.

Here’s an example of a contrived example:

DestroyFunc a
AddToFunc a
+ I WindowStyle Sticky
+ I UpdateStyles
+ M PipeRead 'echo Move'
+ M Exec exec xmessage "Afterwards"

Note what’s happening here. The above says that immediately, the window is to be sticky, and the updated style applied immediately as well (as opposed to post-function ending). The window is to then be Moved if Motion is issued on it, and xmessage is run with the message ‘Afterwards’.

The crucial thing to learn there is that xmessage will always display after the window has finished being moved because PipeRead blocks FVWM from doing anything until it completes – it inherently gives us the scheduling factor needed here.

Since you haven’t said in your example how you plan to make the window transparent (I assume via transset-df or what have you) then you will have to ensure that you do something like this:

DestroyFunc b
AddToFubc   b
+ I PipeRead 'echo Exec exec whatever -options'
+ M PipeRead 'Move'
+ I Exec exec foo .... -options

Hope that helps.

– Thomas Adam

  • M

Hi Thomas,

I tried out some functions using your hints. The following one is working well with fvwm 2.5.18 (current gentoo stable) and transet-df-5 from forchheimer.se/transset-df/.

[code]DestroyFunc TransparencyMove
AddToFunc TransparencyMove

  • I PipeRead ‘echo Exec exec transset-df -i $[w.id] 0.7’
  • M PipeRead ‘echo Move’
  • M Exec exec transset-df -p 1[/code]

Thank you very much for your help!

Regards,
D.Morlock

Hi, sorry for answering in such old topic, but I didn’t want to start new one. This function:

[code]DestroyFunc TransparencyMove
AddToFunc TransparencyMove

  • I PipeRead ‘echo Exec exec transset-df -i $[w.id] 0.7’
  • M PipeRead ‘echo Move’
  • M Exec exec transset-df -p 1[/code]
    doen’t work for me. I figured out, that problem is transset-df -i $[w.id] 0.7 command. When I execute it in zsh i get this error:
zsh: bad floating point constant

And in bash:

bash: w.id: syntax error: invalid arithmetic operator (error token is ".id")

I really don’t know how to fix it. :confused:

What version of FVWM are you using? This of course works fine for me. What version of bash and zsh have you?

– Thomas Adam

Bash 3.2.039-3, zsh 4.3.5-2, Fvwm 2.5.26-2. I’m using newest Arch x86_64…