Binding to a modifier AND mod-ed keys?

I don’t really spend a lot of time fiddling with fvwm (not that I don’t WANT to, just I don’t HAVE any :wink: ), but I’ve started my own Config From Scratch ™ and I’m mulling over what keybindings would be sweet. Currently I’ve got Win+Q set to `Delete’ a window, which I like for cleaning up my desktop >D
However, as I recall, as soon as I added the Q binding with Win as a modifier, my binding for Win stopped working (no suprises here, I had Win bound to open a menu).
I never thought much of it, just decided to live without the menu-on-win-press… but here at work we have KDE, which by default opens the root menu when I press Win and also lets me bind commands using Win as a modifier. And thinking about it, I realised windows does the same thing (Start+R for run etc).

So, I’m curious whether this is in fact a limitation of fvwm or I just don’t know how to do it.

I hope you mean “close”, as opposed to “delete”, as the latter is not considered fair play with X11.

You need to see the main FVWM FAQ, as it is listed there.

– Thomas Adam

I noticed similar behaviar when mapping a win+r to a open a box to type a single command to start a program or so.

I had my root menu bound to the left and right windowskey with Key Super_L A A ... Key Super_R A A ...
I then added this entry for the run-dialog:

Key R A 4 Exec exec $[HOME]/.fvwm/run-dialog
This however didn’t seem to work.

But as you can see, in the second code example there is referd to the windows key with ‘4’ (probably from mod4).

I didn’t really need the menu popping up when I press the windows key so I just disabled the first 2 entries.

however, now that I’m writing this, I just thought of what might be the cause of the problem.

In the first example, the windows key is definend as the key to press, in the second example, the key is defined as a modifier!
So I guess this conflicts. probably the first defined type (as a key or as a modifier) will be the thing that works. As I said, it just came up in my mind, so I didn’t try to mess with these things.

I didn’t spend much time understanding all the possibilities with keys, so maybe someone else can explain what is happening exactly and what should be done to make this work.

hope this helps.


I just did a little experimenting with the console to bind the Super_L to pop open my root menu. It appears that key bindings get resolved on key press and not key release. If I hold Super_L, the root window pops up. Then I hit escape and the menu goes away. Still holding the Super_L and clicking on a window fires off the appropriate mouse + Super_L binding.

If key bindings do get fired on key press and not release, maybe it would make sense to change it at the code level so that it resolves it on key releases, then it would be able to make the distinction between the windows key being pressed by itself or being pressed as a modifier. Then again, I’ve never even looked at the code, so what do I know…

Thomas, were you referring to this FAQ? I can’t find the part about the windows key on there, can you provide a link?

I’m afraid a KeyRelease event is just plain impossible, see this post on the fvwm mailinglist.

That’s right – it’s due to the events that keys send to the Xserver, and how they’re then intrepreted by FVWM. The details of which I won’t trouble you with.

Because it isn’t possible. By an odd coincidence, your question was answered yesterday on the FVWM mailing-list – the link theBlackDragon posted to you should suffice. The code for key-release was trialed in FVWM many versions ago, but it was not very reliable. I’ve been telling people this for a long time, now.

I was, but a further review of your question reveals that the answer is more complex than what is mentioned there about modifiers.

– Thomas Adam

Just curious about the fact that it seems to work in kde (which I did not try myself), wouldn’t it be intersting to have a look at the code of kde to see how they do it?
I know kde is qt-based. I have no idea on what fvwm is based, but propably something completely different so their solution probably wont be portable to fvwm. Does it work in gnome? maybe use there code? any other wm which is possebly closer related to fvwm?

:unamused: never mind, probably just me thinking to much :unamused: :wink:

Not really. I suspect KDE doesn’t do what you think it does, anyway.

Not that I am aware of. But please see my previous post in this thread.

– Thomas Adam


I interpreted this as meaning Close does a Delete command followed by a Destroy command if necessary, and therefore binding to Delete is the most friendly way I could possibly close windows - have I misunderstood?

In any case, I like the feel and customisability of fvwm much more than KDE (I should check what WM we have at work) - I haven’t run into any retarded hardcodes like the mouse cursor being warped about 25% toward screen centre when I edge-flip to the next desktop[1] or not being able to bind actions to the scroll-wheel[2] or the focus not following the mouse while I’m holding the Win key[3]. It just occured to me that with the extra flexibility it might actually be possible to emulate the Win menu thingy.

[1] My relationship with GUIs and the mouse is like this ahem IT’S MY FKN MOUSE CURSOR DON’T TOUCH IT
[2] Scroll-up on title bar to shade, scroll-down to unshade ] Can’t remember if other modifiers were affected or not

Yeah, I saw that later on in the afternoon. It’s not very often I see someone say that something just isn’t possible…

Were you hoping to avoid it sending a destroy via the close command? I’ve bound Close as my window operation for removing windows, and I’ve never had it call a destroy. Delete on the other hand will often kill an entire application when I really only wanted to close one window.

As far as I understand ‘killing an applicateion’, I understand that the application doesn’t get the chance to save any configurations you might have set when the program was open (I have this with my keyboard powerbutton in windows :unamused: )

So it’s probably best to close a window.


By the way, KDE at work got upgraded this week and I can’t bind anything to the Win key anymore :wink:

(it might work if I unbound all my Win+* keys, but that sounds like too much hassle)