May 2, 2006

Doubleclick in FvwmScript

Posted in FVWM at 13:34 by theBlackDragon

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.

Advertisements

1 Comment »

  1. gavenkoa said,

    You can see another Fvwm spelling error in Fvwm keywords in FAQ:

    GlobalOpts StipledTitles

    (Yes, the spelling was inconsistent.)

    http://www.fvwm.org/documentation/faq/#3.8


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s