Subject: Fwd: Re: FVWM: Conditional Functions

From: Mark <[email-masked]>
Date: Thu, 3 Feb 2005 14:03:11 +0100

Forgot to include the list .. 

----------  Forwarded Message  ----------

Subject: Re: FVWM: Conditional Functions
Date: Thursday 03 February 2005 14:02
From: Mark <[email-masked]>
To: Marc Schlienger <[email-masked]>

Hi Thank you very much for your reply!

How would I bind this to a key binding ??

My main problem was making a conditional function binding that would Toggle
the status..

I find it very difficult (well impossible for now:-) to make a function that
would bind to one keybinding like I have now (Alt + S), store a window id (if
any) and restore the mouse after i toggle.

The preprocessor stuff is new to me though although i have read somewhere
 that m4 and cpp are possible.. would this be usefull to reduce startup time
 ??

Thnx
Mark

On Thursday 03 February 2005 09:33, you wrote:
> On 02:16 Thu 03 Feb?, Mark wrote:
> > Hi I was trying to improve the useability of my config, until now I had a
> > simple All (XMMS_Player) Iconify Toggle
> > to show/hide my xmms.
> >
> > What I don't like on this setup is the fact that when I am working in a
> > window and I've "Toggled" my Xmms, changed a song and I'm ready to
> > continue work I have to manually regain focus on my "work" window..
> >
> > So I've tried to come up with a way to capture the pointer position
> > before I DeIconify Xmms and restore it when I Iconify again...
> >
> > I've made 2 functions:
> > # Show XMMS
> > DestroyFunc ShowXmms
> > AddToFunc ShowXmms
> > + I Exec echo $[w.id] > $[FVWM_CONFIGDIR]/.XmmsWinId
> > + I All (XMMS_Player) Iconify Toggle
> > + I All (XMMS_Playlist) WarpToWindow 50 50
> >
> > # Hide XMMS
> > DestroyFunc HideXmms
> > AddToFunc HideXmms
> > + I All (XMMS_Player, !Iconic) Iconify
> > + I PipeRead 'echo WindowId `cat $[FVWM_CONFIGDIR]/.XmmsWinId`
> > WarpToWindow 50 50'
> > + I Exec rm $[FVWM_CONFIGDIR]/.XmmsWinId
> >
> > The above kinda works although it is not very reliable (also the PipeRead
> > works on the Console but not in the function?) but offcourse this is not
> > enough, as it needs to be bound on one keybinding so I was trying to make
> > a ToggleXmms binding to make it al work but failed many times :-(
> >
> > If someone already has a similar function or a tip/solution please let me
> > know.
> >
> > Mark
> > --
> > Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
> > To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
> > message to [email-masked].
> > To report problems, send mail to [email-masked].
>
> Hi,
>
> try adding the function
>
> DestroyFunc .
> AddToFunc .
> + I SendToModule FvwmPerl preprocess -c -- $*
>
> to your config and change the two functions above to the following:
>
> DestroyFunc ShowXmms
> AddToFunc ShowXmms
> + I Pick SetEnv WID $[w.id]
> + I All (XMMS*) Iconify Toggle
> + I All (XMMS_Playlist) WarpToWindow 50 50
>
> DestroyFunc HideXmms
> AddToFunc HideXmms
> + I All (XMMS*, !Iconic) Iconify
> + I . WindowId $[WID] WarpToWindow 50 50
>
> Now you may assign a keybinding to this two functions and it should work.
> If not please let me know!
>
> Regards
> Marc

-------------------------------------------------------
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Mark <[email-masked]>
Date: Mon, 7 Feb 2005 16:01:59 +0100

Unfortunately no more replies on the subject .. does this mean it is 
impossible ??
On Thursday 03 February 2005 14:03, Mark wrote:
> I find it very difficult (well impossible for now:-) to make a function
> that would bind to one keybinding like I have now (Alt + S), store a window
> id (if any) and restore the mouse after i toggle.
>
>  that m4 and cpp are possible.. would this be usefull to reduce startup
> time ??
>
> Thnx
> Mark
>
> > > Hi I was trying to improve the useability of my config, until now I had
> > > a simple All (XMMS_Player) Iconify Toggle
> > > to show/hide my xmms.
> > >
> > > The above kinda works although it is not very reliable (also the
> > > PipeRead works on the Console but not in the function?) but offcourse
> > > this is not enough, as it needs to be bound on one keybinding so I was
> > > trying to make a ToggleXmms binding to make it al work but failed many
> > > times :-(
> > >
> > > If someone already has a similar function or a tip/solution please let
> > > me know.
> > >
> > > Mark
> > > --

---

From: jpkotta <[email-masked]>
Date: Sat, 12 Feb 2005 15:32:56 -0600

If I understand you correctly, you want a key binding that toggles between  
XMMS and whatever window you're working in.  Try this:

DestroyFunc ShowXmms
AddToFunc ShowXmms
+ I Pick SetEnv WID $[w.id]
+ I All (XMMS*) Iconify False
+ I Next (XMMS_Playlist) WarpToWindow 50 50

DestroyFunc HideXmms
AddToFunc HideXmms
+ I All (XMMS*) Iconify True
+ I WindowId $[WID] WarpToWindow 50 50

DestroyFunc XmmsToggle
AddToFunc XmmsToggle
+ I	Current (xmms) HideXmms
+ I	TestRc (!Match) ShowXmms

Key S A M ToggleXmms

BTW, I keep my xmms swallowed in a buttons bar, which is normally hidden  
but raised when my pointer hits the west edge of the screen.  The only  
complaint I have about my method is that if I do a restart of fvwm and  
xmms is playing, I have to stop it to get it swallowed again.

jpkotta