On Fri, 25 Feb 2005 00:14:28 +0000, Thomas Adam
<thomas_at_edulinux.homeunix.org> wrote:
> On Thu, Feb 24, 2005 at 12:54:09PM -0500, Dan Espen wrote:
> > To Fvwm, it looks like you hit the key many times.
>
> Indeed. I suppose you could kludge the delay:
>
> Key X A M Schedule 1000 exec xterm
>
> While this will delay the execution slightly, holding down the key
> combination will still result in the xserver queing the key press
> events -- but the rate of xterms launced might diminish as a result. :)
> Try it and see.
>
> -- Thomas Adam
>
> --
> I know nothing, and understand even less.
I liked this solution, so I expanded it a bit to better match the
original request. I created the following:
#===begin config changes for sample 1===
Key X A CM CarefulOpen xterm -bg black -fg green
Key Y A CM CarefulOpen firefox
#Set the following variable to the delay in ms to prevent additional windows
#from being opened for the duration of that delay
SetEnv open_delay_ms 5000
DestroyFunc CarefulOpen
AddToFunc CarefulOpen
+ I PipeRead "echo 'Test ( \!\$\[dont_open_$0\] \) DoOpen $*'"
+ I PipeRead "echo SetEnv dont_open_$0 True"
DestroyFunc DoOpen
AddToFunc DoOpen
+ I Exec exec $*
+ I Schedule 5000 PipeRead "echo SetEnv dont_open_$0 False"
#===end config changes for sample 1===
In this sample, holding ctrl+alt+x will only allow one xterm per five
seconds of holding the key down. So if you hold the combo down for
only 2-3 seconds, you will only get one xterm - and it gives you that
xterm immediately.
Unfortunately this has a small limitation, if you try it with the same
command, but different argument lists, it can't distinguish between
the two of them.
ie, the following two would look like a match:
Key X A CM CarefulOpen xterm -bg black -fg green
Key Y A CM CarefulOpen xterm -bg white -fg black
Hit either of them, and you'd have to wait 5 seconds before you could
hit the other. This is because the match is done off of just the
first argument.
So I made this more generic solution as well:
#===begin config changes for sample 2===
Key X A CM CarefulOpen_xterm
#Set the following variable to the delay in ms to prevent additional windows
#from being opened for the duration of that delay
SetEnv open_delay_ms 5000
SetEnv safe_to_open_xterm True
DestroyFunc CarefulOpen_xterm
AddToFunc CarefulOpen_xterm
+ I Test ($[safe_to_open_xterm]) DoOpen_xterm
DestroyFunc DoOpen_xterm
AddToFunc DoOpen_xterm
+ I SetEnv safe_to_open_xterm False
+ I Exec exec xterm
+ I Schedule $[open_delay_ms] SetEnv safe_to_open_xterm True
#===end config changes for sample 2===
If anyone is feeling more adventurous, they could take sample 1 and
escape out the entire argument list to generate a suitable variable
name instead of how I have only used the first argument, and that
would eliminate the need for copying sample 2 and creating 2 functions
for each new command. Could probably replace my 'Exec exec $*' in
sample 1 with PipeRead "echo $*" and then it could be bound to menus
and functions instead of just stuff to be exec'ed.
--s.r.d.
--
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 majordomo_at_fvwm.org.
To report problems, send mail to fvwm-owner_at_fvwm.org.
Received on Fri Feb 25 2005 - 08:43:01 GMT