Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
FAQ: Keyboard shortcuts and bindings
Last updated at 2:09 pm UTC on 8 November 2017
Answer needs to be updated.

Q: How do I change or add keyboard shortcuts/bindings?


Marcel Taeumel
<marcel.taeumel@hpi.de>	Sun, Nov 5, 2017 at 1:02 PM
Reply-To: The general-purpose Squeak developers list <squeak-dev@lists.squeakfoundation.org>
To: Milan Vavra via Squeak-dev <squeak-dev@lists.squeakfoundation.org>

Keyboard interaction in Squeak's tools is rather plain and hard-coded. If you want to look into code, here are the places:

Editor, TextEditor, SmalltalkEditor >>

#initializeCmdKeyShortcuts

#initializeShiftCmdKeyShortcuts

#dispatchOnKeyboardEvent:

 

PasteUpMorph >> #filterEvent:for:

DockingBarMorph >> #filterEvent:for:

SystemWindow >> #filterEvent:for:

 

PluggableListMorph >>

    #keyStroke:

    #previewKeystroke:
    #specialKeyPressed:
    #modifierKeyPressed:

 

    PasteUpMorph >> #keystrokeInWorld:

All messages in the form "*Key:from:", which are usually the callbacks from PluggableListMorph

SystemWindow filterEvent:for:



For text-editing key commands/bindings:

See the methodParagraphEditor class>initializeCmdKeyShortcuts (and also initializeShiftCmdKeyShortcuts). You can edit these methods to change text-editing key bindings. For example, if you want to have Emacs-like key bindings. See:Emacs key bindingsif you want that.

After you edit/save the method, be sure to execute "ParagraphEditor initialize" to execute the method and have the changes go into effect.

(These are class-side methods, so you'll need to hit the "class" button in the browser to see them.)

If you're on an MS Windows platform and you want to switch the text editing keys (such as cut, copy, paste, save, etc.) from the Alt key over the to Ctrl key, there is a changeset which does thathere. As of 3.2, Go to Preferences (via the World menu) and choose one of either: "swap control and alt keys" or "duplicate control and alt keys". The balloon help explains it.


For keyboard shortcuts out in the Morphic world:

(When your mouse is not inside any text-editing window.)

Look at the methodPasteUpMorph.keystrokeInWorld:. (Morphic only)

The way cmd-t brings up a transcript should serve as a good model.

You may customize this method for your own convenienceso that your system let you get a change sorter, get a newWorkspace, etc., very quickly, without having to touch the mouse.

Relevant SqueakMap Packages:

There are some packages onSqueakMapthat allow you to manage your keybindings in Squeak:KeyBinder:
KeyBinder modifies the way Squeak handles keyboard events and provides a framework for constructing keyboard bindings.Keymapping:
Provides a framework and UI for creating multi-key keybindings for TextMorphs. Key bindings can be mapped to methods in ParagraphEditor and too arbitrary Blocks of Smalltalk code.
This package provides extensive support for EMACS or VIM commands and modes. Includes fully remappable multi-key keybindings.

(You will still have to touch the mouse to get focus out of whatever morph you're currently typing in, won't you?)

Windows ALT keySand Macintosh icommand key/i seeFAQ: Modifier Keys____registry Windows XP switch keyboards when you hit alt-shift