05.02.06
Doubleclick in FvwmScript
FvwmScript is a scripting language provided by FVWM that allows you to create windows that can integrate perfectly with your FVWM configuration. Unfortunately it is also very limited. It for example doesn't support some sort of DoubleClic[1] event, even though this name pops up in the sources it doesn't seem to ever have gotten implemented.
I came accross this about half a year ago when writing FvwmMpd, an FvwmScript frontend to mpd where I wanted to start playing a file when one doubleclicked a song in the library as having your song change whenever you singleclick an item is obviously annoying…
So I worked out this little workaround:
Widget 1
Property
Position 0 24
Size 450 450
Type List
Title { }
Main
Case message of
SingleClic :
Begin
Set $item = (GetValue 1)
Set $clicks = (Add $clicks 1)
If $olditem == $item Then
Begin
If $clicks==1 Then
Do {Exec mpc play } (GetValue 1) { >/dev/null}
End
Else
Begin
Set $olditem = $item
Set $clicks=0
End
End
End
It obviously is somewhat of an ugly hack but it's about as good as it gets and since I've been asked how to do something like this a couple of times already I thought I might as well publish it here, it might just help someone
[1]The single click event is called SingleClic, which is probably due to the fact that the original author was French speaking.