Sandbox:Keyboard Shortcuts

= Context =

This page is aiming at refactoring the keyboard shortcuts in FreeCAD. Indeed at the moment, several problems exist such as overlapping, lack of consistency, ... When work is over, this page can be mutated so it serves as a keyboard shortcuts overview.

Discussion in the forum

= Timeline =

Proposed activities are (more or less in chronological order) :
 * List all available commands by workbench
 * Define global guidelines
 * Define new shortcuts to commands (following guidelines)
 * Implement in the code

= Global guidelines =

Proposed guidelines :
 * Use standard shortcuts for standard commands across software (New, Open, Save, Undo/Redo, ...)
 * Shortcuts using 'Ctrl' key should be reserved for global commands
 * Function keys (F1 to F12) should be reserved for global commands
 * Shortcuts using 'Shift' key could be used to indicate an opposite/complementary action (to the one without 'Shift')
 * Shortcuts using 'Alt' key should be avoided (it is used to access menus, and 'Ctrl+Alt' or 'Shift+Alt' are often system shortcuts)
 * Shortcuts using only alpha key (single or combo -- without modifier) should be reserved to workbench local commands
 * Shortcuts using only num key (without modifier) should be avoided (to prevent unwanted actions)
 * Shortcuts using system keys ('PrntScr', 'Pause', ...) should be avoided
 * Most used commands should have a shortcut. Not all commands have to have a shortcut.

= List of commands =
 * Note: "A" means the keyboard key A, not the upper case letter A (aka Shift-Key A)

Hidden Global Shortcuts
''These shortcuts are not listed in the Keyboard Customization window. You will not see a warning if one of your shortcuts causes a conflict!''

1. You can switch between workbenches with W, 1 through W, 9. These shortcuts are set automatically when FreeCAD launches. By arranging your workbench list in "Tools->Customize...->Workbenches", then closing and reopening FreeCAD, you can set these shortcuts to your liking. You can check and see these shortcuts in the Menubar's "View->Workbench", but not in the Workbench Dropdown List toolbar.

2. After you click inside the TreeView panel, you can press Ctrl+F to open a search bar. In KDE Linux, you can change the shortcut by opening KDE System Settings and going to Shortcuts->Common Actions->Edit->Find.

3. Std_DrawStyle opens a dropdown menu, making it impossible to change these 7 shortcuts in the GUI:

Customizable shortcuts
Up-to-date for FreeCAD 0.20.1

These global shortcuts do appear in "Tools->Customize...->Keyboard". FreeCAD's GUI lists shortcuts by "Category", but this Wiki page lists shortcuts by "workbench" first. FreeCAD's GUI puts some commands, like "Export Page as SVG" in the file "category", but that command is actually from the TechDraw "Workbench".

Note: In KDE Linux, some FreeCAD shortcuts follow the Common Actions shortcuts found in KDE System Settings. For example, KDE's default Redo is Ctrl+Shift+Z, not Ctrl+Y. If you override the shortcut within FreeCAD, your preference will be remembered even if the KDE shortcut changes. To use KDE's universal shortcuts again, click "Reset" or "Reset All." When FreeCAD launches, it imports KDE's shortcuts, so shortcuts may not seem "up to date" until FreeCAD is restarted. Tested 2022-09-30, Manjaro Linux 5.15, FreeCAD 0.20.1 (flatpak)

Arch Workbench
Up to date for FreeCAD 0.20.1

Draft quirks:
The Draft workbench handles some shortcuts in unique ways.

First, in "Edit -> Preferences -> Draft -> User interface settings", there is a list of "In-Command Shortcuts". These shortcuts are available if a Draft tool is active and the cursor is blinking inside a text box. Regular hotkeys (letter-only keyboard shortcuts) are disabled while a textbox is active, so these shortcuts won't interfere with anything. After text is entered into the text box, In-Command Shortcuts will deactivate and act as regular letter keys. For example, if the user types "sn15 in", S will toggle snapping, the first N activates the "Wipe" command, and the second N will type "n" because it comes after "15 i".

Second, in "Edit -> Preferences -> Draft -> Grid and snapping", there are three "Snapping" modifiers that can be changed by the user. By default, Constrain mod = Shift, Snap mod = Ctrl, and Alt mod = Alt. Notably, these settings do not affect the Dimension (Draft_Dimension) tool. Dimension is always hard-coded to be Shift=Snap, Ctrl=Constrain, and Alt=Angle/edge length.

Third, it is difficult to set shortcuts for Draft Snap commands. See this forum thread for a workaround: https://forum.freecadweb.org/viewtopic.php?t=67658&p=585119

Normal Draft Stuff:
Up to date for FreeCAD 0.20.1

After all of that, here is the normal list of Draft commands and shortcuts.