KeyboardProcessing - robmcmullen/peppy GitHub Wiki

Table of Contents

Keyboard Processing

Keyboard processing in peppy is a bit complicated because it can handle multi-stroke commands as in Emacs.

Background info on Emacs-style keybindigs:

Specifying Key Bindings

Key bindings are specified using a special shorthand showing the modifiers of the key and the key itself. Modifiers are:

  • S- Shift
  • C- Control on win/unix, Command on mac
  • !^ Control on all platforms
  • M- Meta or Alt on win/unix, Option on mac
Keys are then specified using a string listing the modifier characters separated by the - character, and then the unshifted character itself. Unmodified keys are also possible -- if the keystroke doesn't contain a - character it is used as a literal character. For example:
  • x the letter X
  • s the letter S
  • S-s shift S
  • C-a control A on win/unix, Command A on mac
  • !^Q control Q on all platforms
  • S-/ shift slash (note that you can't specify a ? directly -- keys are recognized by their unshifted state in wx)
  • M-C-q alt control Q
Multiple keystrokes are separated by spaces:
  • C-x C-s control X followed by control S
  • C-x 5 2 control X followed by the number 5 followed by the number 2
Special characters are given by their text equivalent:
  • TAB the tab key
  • S-UP shift up arrow
Here's a list of special characters (note that this is really just the WXK_ name with the WXK_ prefix):
  BACK TAB RETURN ESCAPE SPACE DELETE START LBUTTON RBUTTON CANCEL MBUTTON CLEAR PAUSE CAPITAL PRIOR NEXT END HOME LEFT UP RIGHT DOWN SELECT PRINT EXECUTE SNAPSHOT INSERT HELP NUMPAD0 NUMPAD1 NUMPAD2 NUMPAD3 NUMPAD4 NUMPAD5 NUMPAD6 NUMPAD7 NUMPAD8 NUMPAD9 MULTIPLY ADD SEPARATOR SUBTRACT DECIMAL DIVIDE F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F20 F21 F22 F23 F24 NUMLOCK SCROLL PAGEUP PAGEDOWN NUMPAD_SPACE NUMPAD_TAB NUMPAD_ENTER NUMPAD_F1 NUMPAD_F2 NUMPAD_F3 NUMPAD_F4 NUMPAD_HOME NUMPAD_LEFT NUMPAD_UP NUMPAD_RIGHT NUMPAD_DOWN NUMPAD_PRIOR NUMPAD_PAGEUP NUMPAD_NEXT NUMPAD_PAGEDOWN NUMPAD_END NUMPAD_BEGIN NUMPAD_INSERT NUMPAD_DELETE NUMPAD_EQUAL NUMPAD_MULTIPLY NUMPAD_ADD NUMPAD_SEPARATOR NUMPAD_SUBTRACT NUMPAD_DECIMAL NUMPAD_DIVIDE

Default Key Bindings

Default key bindings are specified in each action. Each action includes (or can include) a class attribute called key_bindings that, when not None, is a dict that maps the key set name (i.e. "win", "mac", "emacs") to the keystroke. There is also a key set named "default" that will be applied to all platforms unless overridden by a specific platform. For example:

    key_bindings = {'default': "C-e", 'mac': "C-a", 'emacs': "C-x C-n"}
will set the mac keybinding to Command A, the emacs keybinding to the keystroke sequence Control X followed by Control N, and because windows is not specified explicitly, the default keybinding will be Control E on windows.

User Configuration

See ConfigurationFiles for information on how to customize keybindings.

⚠️ **GitHub.com Fallback** ⚠️