Re: FVWM: Question regarding actions when modifier keys are held down/released

Stephen Dennison <[email protected]>
Newsgroups gmane.comp.window-managers.fvwm
Message-ID <CAD_jPZ=FXmuH5AfSxkLMemsHo6dTfZWeMgZUtpcST+yfJwrTqA@mail.gmail.com>
On Thu, Aug 29, 2019 at 8:43 AM Dave Weller-Fahy
<[email protected]> wrote:
>
> On Thu, Aug 29, 2019 at 2:16 AM Martin Cermak <[email protected]> wrote:
> > On  Wed  2019-08-28  13:03 , Dave Weller-Fahy wrote:
> > > My goal is to have the following rules followed.
> > >
> > > Rules about keys being pressed and (possibly) held.
> > > - If Ctrl-Alt are pressed ...
> > >   - and if no other keys are pressed within some period of time ...
> > >     - then pop up the pager
> > >   - and if other keys (such as arrow keys) are pressed ...
> > >     - then execute some other action
> > >
> > > Rules about keys being released.
> > > - If Ctrl-Alt are released ...
> > >     - and if the pager is displayed ...
> > >       - then remove the pager
> > >
> > > The use case is to have Ctrl-Alt-(up|down|left|right) change desks,
> >
> > I have this setup too (as an option).  But primarily I use
> > Ctrl-Alt-(<keypad key 1..9>).  This gives me a clear idea which
> > of my 9 desks (arranged as a 3x3 matrix) I am switching to.
> > Nothing visual involved.
>
> Thanks for the confirmation! I have the Ctrl-Alt-direction (or any other
> arbitrary key combination to change desktops) working perfectly: I
> should have been more clear on that. The thing I've not been able to
> accomplish is getting the pager to pop up when keys are pressed and
> then go away when those same keys are released.
>
> I was reaching the conclusion that what I wanted was not possible with
> fvwm (at least, not possible without an external utility), but figured I
> would check with the mailing list before giving up and looking for an
> external utility to help. I may also try fvwm3 to see if what I want is
> possible there.
>

You can bind a key to a modifier and set the unbound one as your
modifier (Key Control_L A M Exec exec executable.name    or  Key Alt_L
A C Exec exec executable.name   or ...)
And that can still be used for some other action (Key T A CM Exec exec
other-executable.name would still work, for example) but it will cause
your executable to be executed even when you're just using the alt and
control as modifiers.

You could make a wrapper script that uses xlib and does a
`display.query_keymap()` to see if the keys are still being held down.
Then if after a set time the key isn't still held, you might decide
that the wrapper was invoked intentionally and should then call a
function in fvwm to toggle your pager.  It would take a little getting
used to, as you'd train yourself to hold modifier keys for a brief
pause when executing stuff other than toggling the pager, but it's not
impossible.

I had experimented with using the windows key to do something on its
own when not being used as a modifier key, but I eventually discarded
it.  I posted about it to the fvwm forums, which can be found here:
https://fvwmforums.org/phpBB3/viewtopic.php?f=6&t=2832#p14222
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.