Help me gather keystrokes and mouse events for varied platforms

If you have a couple of minutes to spare (it shouldn't take you more than 5min in total), it would be great if you could help me gather accurate key-event% and mouse-event% for different platforms.

To do so:

  1. raco pkg install racket-paint (which contains an experimental event listener. The paint program itself is irrelevant.)
  2. racket -l- racket-paint/event-listener --no-erase --mouse-state --system-info
  3. Type exactly the following sequence of keys (don't use the mouse wheel):
  • a, c:a, s:a, c:s:a, cmd:a, cmd:c:s:a
    (where c: is the control key, s: is shift, and a is just a)
  • return, c:return, s:return, c:s:return, cmd:return, cmd:c:s:return
    where return is the return key.
  • mleft, c:mleft, s:mleft, c:s:mleft, cmd:mleft, cmd:c:s:mleft
    (where mleft = mouse left)
    Instead of cmd you can choose a modifier of your choice (caps, rshift, ...), just let me know which you tried.
  1. Click Copy, then paste into a file editor.
  2. Send me the results somehow: in this thread within a [details] block, in a private message on slack, in a email, pastebin, your choice.

Note that at the top there is some information that's specific to your machine. If for some reason you are not comfortable sharing these details, you can erase some of them, but I'd need at least the platform.

Thank you very much!


What if your keyboard doesn't have a cmd key?

Apparently I cannot read...


Sent you my keystrokes. Out of curiosity, what is it for?

Thanks Marc!

I've had a number of issues with keybindings in DrRacket and elsewhere, and I've observed some discrepancies depending on the platforms and versions.

For example, for some mac users (but not all), no modifier is recorded with a mouse event. Sometimes it's recorded by (get-mouse-state) but not by the mouse event itself, but not always. Also, GTK is inconsistent with when modifiers are considered up and down. I'll share here the results of my findings of course.

So I'm gathering some information to try to pin down the issues and see if anything can be done.

I'm also working on an alternative way to make keybinding actually work for all platforms: Instead of handcrafting the expected mouse events and trying to be smart about the various platforms (which seems hard, annoying, error-prone and varying over time and OS versions), the idea is simply to ask the user to perform the desired key or mouse event and record it. (Emacs does this.) The event listener is a means to make this easy for the user.

The (unstable) racket-paint program is a test-bed for this. If you run racket -l racket-paint, you'll see a keymap menu that allows to customize all keybindings with the event-listener. Ctl-left-click on a button also lets you rebind the default shortcut to a button. But it's still WIP.


Very nice, thanks for putting the work in to do this. Sounds like a really important, useful, and boring task.

And yes, the application crashed for me at some point.

Crashes shouldn't happen :slight_smile: If you still have the log or if it happens again, please file an issue here.

No, I don't unfortunately. I'll run it again at some point and see if it happens again (it happened while sitting around doing nothing).

1 Like

Thank you everyone for sending me your reports, this has been quite helpful. I found a few issues with mouse-event%s, in particular on Mac. This issue gives more details:


Here's another keybinding issue in DrRacket:

My keyboard has several X layout groups, so that when I press Caps-Lock it goes to the second layout group.

In DrRacket, if I press Alt-t (keycode 44 per xev, keysym 0x74 "t") in the first layout, it drops down the Tabs menu item as it should.
But when I first press Caps-Lock, the same combination of keypresses corresponds Alt-Left (also keycode 44 per xev, keysym 0xff51 "Left"), and the Tabs menu drops down again, despite me not pressing Alt-t, and therefore preempts the intended behaviour of backward-sexp.

The (purely Racket) event-listener [1] is able to distinguish between the two cases, reporting Alt-t and Alt-Left respectively.

Does anyone know from the top of the head whether this menu issue is a hopeless Gtk issue, or if there's hope it could be fixed within racket/gui? (@robby @mflatt I assume)

Edit: gedit does not preempt Alt-Down (same keys as Alt-s, bound to Save), so I suspect this is a racket/gui issue.

Edit2: I don't understand where label is used to set the gtk accelerator: gui/menu.rkt at master · racket/gui · GitHub I can't see a single use of it :thinking:

[1] The event listener:

raco pkg install racket-paint
racket -l racket-paint/event-listener