Subject: FVWM: Binding a mouse click to a key press

From: Andy Arbon <[email-masked]>
Date: Fri, 19 Apr 2002 22:52:31 +0100

Hello,

I have an icon on my desktop which when clicked causes a panel 
containing other apps to slide out from the side. What I'd like to do is 
add in a keyboard binding to trigger the panel slide in/out. Can anyone 
tell me how to do that?

I've included a few relevant lines below for illustration

Cheers,

Andy

#
*BarButtons: (Panel(left, delay 0, steps 16, position 100 270p, smooth) 
SubPanel "Module FvwmButtons SubPanel") Icon mini.penguin.xpm

# To define the panel as an instance of
# FvwmButtons with a different name:
*SubPanel: (1x10 Swallow (NoClose, UseOld) licq 'Exec licq &')
*SubPanel: Geometry 150x500-100+100
*SubPanel: (Swallow XClock 'Exec xclock -digital -bg beige -update 1 
-geometry 100x20&')
*SubPanel: (1x2 Swallow XLoad 'Exec xload -hl black -bg beige -fg blue 
-update 1 -jumpscroll 1 -label "CPU Load" &')
*SubPanel: (1x4 Swallow FvwmPager "FvwmPager 0 3")

--
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: Mikhael Goikhman <[email-masked]>
Date: Sun, 21 Apr 2002 17:56:04 +0000

On 19 Apr 2002 22:52:31 +0100, Andy Arbon wrote:
> *BarButtons: (Panel(left, delay 0, steps 16, position 100 270p, smooth) SubPanel "Module FvwmButtons SubPanel") Icon mini.penguin.xpm
> 
> *SubPanel: (Swallow XClock 'Exec xclock -digital -bg beige -update 1 -geometry 100x20&')
> *SubPanel: (1x2 Swallow XLoad 'Exec xload -hl black -bg beige -fg blue -update 1 -jumpscroll 1 -label "CPU Load" &')

Try this in 2.4.x:

  AddToFunc SimulateClickOnButtonBar
  + I Next (BarButtons, CirculateHit) WarpToWindow 50 50
  + I FakeClick depth 0 wait 200 press 1 wait 100 release 1

  Key C  A  MC  SimulateClickOnButtonBar

Press Ctrl-Alt-C anywhere to collapse/expand your panel.

If you use 2.5.x, you may even restore the original pointer position,
but I don't give an example for this, since there soon be a better way.

Regards,
Mikhael.

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 22 Apr 2002 11:45:59 +0200

> but I don't give an example for this, since there soon be a better way.

I'd rather not recommend to use the FakeClick command to anyone
because it's just a testing/debugging hack.  There is still Q3.5
in our FAQ:

----------------------------- snip -----------------------------
3.5  You can bind mouse movements to keystrokes, how about mouse
     presses?

A: Although fvwm has commands for binding movements to keystrokes,
   controlling the pointer with the keyboard should really be handled by
   the X server.  The following is an excerpt of the X FAQ on this topic:

      If you have the X Keyboard (XKB) Extension, you can enable mouse keys,
      which makes it possible to generate mouse motion and button events
      using the keyboard.  Events generated by MouseKeys are completely
      transparent -- they will work with any application that connects to a
      server that has the X Keyboard Extension, regardless of whether the
      application itself uses XKB.

      XKB is enabled by default in X11R6.1.

      First, set up the Num Lock key so that Shift+Num_Lock toggles mouse keys:

       xmodmap -e "keysym Num_Lock = Num_Lock Pointer_EnableKeys"

      (XFree86 3.1.2E is based on R6.1 and has the X Keyboard Extension;
      it also has a binding to Pointer_EnableKeys in its default keymap.
      You use Alt+Shift+Num_Lock to toggle MouseKeys on and off.  If you
      are using an earlier release of X or XFree86, you won't have XKB and
      the instructions will not work.  See http://www.XFree86.org/FAQ for
      more information.)

      You might also have to turn off server num lock for this to work.
      Now press "Shift+Num_Lock" to enable MouseKeys.  When MouseKeys are on:

      o)   The keypad arrow keys move the pointer
      o)   The keypad '5' key behaves like the 'default' pointer button
      o)   The keypad '0' key locks the default pointer button (for easy
           dragging)
      o)   The keypad '.' key unlock the default pointer button (to release
           a drag)
      o)   The keypad '+' key double-clicks the default pointer button.
      o)   The keypad '/' key sets the 'default' button to Button1
      o)   The keypad '*' key sets the default button to Button2
      o)   The keypad '-' key sets the default button to Button3

      This is the default configuration, but the mechanism allows for nearly
      infinite configurability.

      [thanks to Erik Fortune ([email-masked]), 6/96]
----------------------------- snip -----------------------------

Bye

Dominik ^_^  ^_^

-- 
Dominik Vogt, email: [email-masked]
LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen
fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20
--
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: Mikhael Goikhman <[email-masked]>
Date: Mon, 22 Apr 2002 11:42:03 +0000

On 22 Apr 2002 11:45:59 +0200, Dominik Vogt wrote:
> because it's just a testing/debugging hack.

I know this, but it works well for me and fully solves the request.

> There is still Q3.5 in our FAQ:
> 
>       using the keyboard.

Unfortunately this does not help at all in solving the request - to be
able to press a single key to slide/unslide a subpanel.

Regards,
Mikhael.