enforcing a key lockout when a bound key is pressed


I want to enforce that when a bound key is pressed, no other key press will be recognized or even allowed for a certain amount of time.

Is there any way to do that in fvwm?

e.g., when F4 is pressed, application foo starts. There is a 4 second time period, after F4 is pressed, before another key press (any key press) will be recognized.

I know this seems weird… but there are reasons behind this madness.

Anyone know how to do this? I spent some time yesterday looking through man fvwm SCRIPTING AND COMPLEX FUNCTIONS section as well as CONDITIONAL COMMANDS… but I didn’t find anything and I am wondering if I am either looking in the wrong place or if such a thing is not possible in FVWM.

Thanks in advance,

Could I use ModuleSynchronous perhaps?

No – FVWM has no control over key-bindings. That’s what the Xserver does.

I’d love to hear them. :slight_smile:

– Thomas Adam

ModuleSynchronous is to do with Fvwm modules, not key-bindings. I suppose, thinking about it some more, assuming these key-bindings you wanted to block were defined by FVWM, what you could do is run a function when F4 is pressed that clears all the key-bindings, and then after 4 seconds, puts them back again:

DestroyFunc clearKeys
AddToFunc clearKeys
+ I Key foo A A -
+ I Key foo2 A M -
+ I Schedule 4000 someotherfunc

DestroyFunc someotherfunc
AddToFunc someotherfunc
+ I Key foo A M my_command
+ I Key foo2 A M function_foo

Very ugly.

– Thomas Adam

Thomas –

The key’s that I don’t want to have hit are other bound key’s… and yes, removing the bindings, and then restating them might solve the problem, but is an ugly kluge… which might end up being ‘a’ solution, but I hope is not ‘the’ solution…

Reasons being, I have an application that pulls up images/pics/gifs/etc, and for some reason, if any keys are pressed while it is coming up, it freaks out - in random, weird ways. So, my thought, since I am dealing with people who won’t leave well enough alone and just not press anything while that app loads, was to ‘freeze the keyboard’ for some set number of miliseconds…

So, I will play with the idea you gave, and see how it works with my situation.

I could always go into events.c (maybe) and set a time out after that event (F4) comes through that nothing else is allowed from the keyboard for some X number of seconds…

Anyways – if I can find a good/ok solution, I’ll post it so you can all see it.


But changing FVWM to do this probably won’t be possible. You have to realise that key-bindings are the ultimate responsibility of the Xserver.

I’d be far more inclined to fix this application, or tell the people that wrote it that it sucks… :slight_smile:

– Thomas Adam