Hotkeys, anyone?

Hi all, rapha from IRC here. So far I’ve only been a lurker but this warrants a post, so here goes. Each time I’m using LibrePCB (which is not that often for lack of time) I notice I’d have more fun working with it if there were hotkeys for everything. That’s not so easy to get right and I’ve been asked to prepare a list of what would need to have a hotkey in the first place. Seems like a spreadsheet might be helpful for having such a discussion:

(Apologies to anyone who doesn’t have a Google Account - it sucks having to make these assumptions. Please let me know and I’ll send an .ods or .xlsx your way!)

Looking forward to your criticisms and comments!

Hi Rapha,

Yes, LibrePCB needs a good set of hotkeys :+1:

First thing I would say is that the easiest key to strike is ‘space’, so we have to use it a lot.
I think also that shortcut should be contextual.
For example, when you are dragging a component, ‘space’ should rotate.
But when you are drawing a wire, it should change orientation (ok, it some kind of rotation !) of the wire (cf https://github.com/LibrePCB/LibrePCB/issues/549).

And there’s also other easy accessible keys : ‘tab’, ‘backspace’ & ‘enter’

I think we should think about contextual scenarii.
For example, when you are drawing a wire, it is natural to type ‘backspace’ to delete the last segment.
It might also be natural to change layer with ‘page up’/‘page down’ or +/-, or directly with ‘1’ to ‘9’ keys.

And also, I think that we should be able to see a list of what is possible in the current context.
Something like this is implemented in Kicad when you type ‘?’.
The problem is that in Kicad it is never up to date :woman_facepalming:

D.

Hi,

Thanks for the list @rapha!

I noticed that single-character shortcuts (e.g. “R” for rotate) are currently a problem when adding new components, since the focus is in the “value” input field in the toolbar. This is by purpose to allow specifying the value (e.g. the resistance of the added resistor) immediately when adding a component. But unfortunately it conflicts with shortcuts. A possible solution might be to stop moving the focus automatically into the text field. For example in LibreCAD there is also an input field, and the space key is used to put the focus in it. So for example when adding a resistor you would need to press SPACE+10k+ENTER to specify a value of 10k.

Yeah, such a list would be nice :+1: To avoid outdated information, I wonder if it makes sense to already make shortcuts configurable in workspace settings (see this issue), since this way the displayed shortcuts are just taken from the settings.

Btw, Altium has nice documentation about its keyboard shortcuts, might be worth to take a look at it: https://www.altium.com/documentation/altium-designer/altium-designer-shortcut-keys

@ubruhin , I do not say that shortcuts should be configurable.

And to precise, having an up-to-date list of available shortcuts means adding some code to filter the available ones in the current state.

And for values, I think it would be preferable to use ‘tab’ to go to value field as if there’s many, it will be the same key (‘tab’) to go to the next one.

And this will also allow to keep ‘space’ for rotation :grin:

And thanks for the link of Altium shortcuts.

Hi, thanks for making this list,
the lack of shortcuts has also been a minor annoyance for me in using LibrePCB.
I have some thoughts with respect to the “Add components” hotkeys.
Currently, when the “Add components” dialog pops up, the search bar is focused, and that seems quite reasonable to me.
This would conflict with single-char shortcuts in that view, but as a workaround I propose to hardcode certain search queries (such as “r”) to force the first result to be a resistor.
If the first result is automatically selected, that would mean you could then add a resistor by pressing , , .

Seems that right click has two different functionality :

  • rotate
  • cancel action

So unpredictable result !

Another thought: currently, the automatical focus on the “value” text input when placing a component in the schematic conflicts with the use of arrow keys for moving the view around - I don’t know whether this can be resolved

Woah @rapha this is some solid compilation. I was thinking maybe we should also add some columns for what other EDA tools use, to maybe draft some inspiration and/or keep some industry standards?

Maybe also add a column for easy to remember “mnemonic”?

Hi Tubbles, thanks for taking note of it! Originally, that was the plan. Unfortunately, the pandemic has shifted things in my life around so much that I’m struggling to follow up on hobby activities. If you (or anyone else reading this) has some time to spare and would love a comprehensive set of hotkeys in LibrePCB, it’d be great if that list got some more columns to it! The project leads have clearly indicated that if that work is put in, they won’t be opposed to it getting implemented.

Hi all,
default hot keys is one thing, but each user use their favourite hot keys (depends on system which use before). Due this is needs to make a user-definable hot keys. And saveable to file (import export also).

see: https://github.com/LibrePCB/LibrePCB/issues/495

And of course, I will try to add some actions for hotkey into your excel list.

1 Like

Thank you EdizonTN, looking forward to taking a look! Perhaps if you know a good online service for spreadsheets, you could move it to something more collaborative? I think that would help with moving this topic forward…

1 Like

Yes I agree, havr you guys had any experience with how keybindings is implemented in e.g. vscode? I think something like that would be very useful along with a command palette such as the one horizon eda also had employed

I notice I am often missing ctrl-tab and ctrl-w. For instance when working with multiple tabs in the library editor.

I’m currently working on the keyboard shortcuts and I have some questions:

IMO it should be able to assign multiple shortcuts for the same action. As an example, I like to have both “Ctrl+Shift+Z” and “Ctrl+Y” shortcuts for Redo, since you never know which tool uses which of these shortcuts, and it’s most intuitive if both of them work. But I’m not sure how to design the GUI for that feature. Providing a list with two columns “Primary Shortcut” and “Secondary Shortcut” would be simple, but I don’t like it because the implementation in the end is simply a list of 0…n shortcuts, without any priority or limitation. But so far I didn’t see a software which allows to assign 0…n shortcuts with a clean UI, maybe someone here knows a good example?

Another question: Are there any conventions how to categorize shortcuts? For example “Ctrl+CHARACTER = apply a modification”, “Ctrl+Shift+CHARACTER = open a particular window”, “F1…F12 = frequently used actions” etc. I don’t know if there are any such commonly accepted conventions how to organize shortcuts, but IMHO it would help to ensure a consistent shortcut concept within LibrePCB, but also consistent feeling across different applications.

Any thoughts from experienced shortcut users welcome :slightly_smiling_face:

1 Like

I know application, which used multiple shortcut for same function. Number of shortcut, for same function, isn’t limited.
And settings is not perfect but is easy:
image
For example, missing list of the functions arranged by shortcut, and show default shorcut (if I click to set to default). Also “reset shortcut for selected function” button missing.

Notice:

  1. Before assign a new shortcut, application have to check if isn’t used by another function
  2. All shortcuts, have to export/import to/from file functionality!

Diablo’s question:
Is able to create two system of shortcuts (switchable, not same time)?

  1. one key (and/or modifier) system: for one function, like CTRL+Y for “Redo”
  2. multiple key (key sequence) system: “E” and next press “Y” for call Redo function. “E” is a shortcut for Edit menu and Y is shortcut for Redo function from this menu. This system will require to place all function to main menu. And each menu and submenu, will require it’s own shortcut.

And for inspiration, you can look into MS documentation
Linux and MAC have a similar docu. I hope.

OK, good to know other software also use the concept of 0…n shortcuts. But yes, the GUI looks very old-school and cumbersome :wink:

I have now made some experiments. This is my current suggestion how this could look in the workspace settings dialog:

librepcb-shortcuts

Italic text means that the shortcut is not overridden so the application default value is used. Bold text means the shortcut is overridden by the user, and stored in the workspace settings file. The default value is always visible as tooltip.

Qt supports this out of the box, even in parallel to “normal” shortcuts :tada:. See the “A,S,D,F” shortcut in the GIF above.

Is this really needed? The shortcuts will be stored in the settings.lp file in the workspace which can easily be copied between different computers. Is there any other use-case for a shortcuts export/import feature?

1 Like

Yes. And this is a commercial (not cheap) application. But functionality is on the first place. It’s not lovely as bunny, but is fast and full of functions.
This look have approx. 22 years :wink:

Ouuu, your suggestion looks very, very usable!
And two system of shortcuts supported… Yummy!
Nice work!

Use case (from my practice and other system):

  1. Make easy to change to the LibrePCB from other EDA systems for the designers.
    If PCB designer try to change the primary EDA system, this jump should be maximal easy as can. The key shortcuts, preddefined in the simple importable file, can make easier this effort.
  2. Shared computer. Especially in the schools - one computer using by various students. Each student can have own favourite shortcuts. And LibrePCB have a simple solution - import.
  3. More than one workplace (my actual situation). Easy - I can synchronize each workspace settings between workplaces.

Really needed? No, We can live without it.
This issue have a higher priority, for me.
Seriously now. If it is possible and easy to implement - why not? LibrePCB can be more usefull and nice to user (especially for a NEW users).

User don’t care where is stored. User need the easy way how to reach points from use cases above. Yes, edit settings.lp copy/paste text is way. But… You know…

And this is not ending by shortcuts.
Same system of the user config, import and export should be also for color settings (in future I hope), workspace settings (norm, length unit,…), editor’s tool box settings, public/user library repositories from internet (in future, maybe), ERC matrix, DRC rules settings, …
Of course, each section should be import/export capability.
But this is a look far away.

And I don’t say about cloud/SVN/GIT,… based storage of the settings :slight_smile:

1 Like

Awesome!

Visual Studio Code doesn’t allow multiple shortcuts for the same action, but it allows assigning the same shortcut to multiple actions, which is then used depending on the context:

Maybe that’s useful for inspiration?

Your suggestion looks quite good to me!

I can also imagine that import/export could be a useful feature, especially for people exporting “compat keybindings” in order to share them with other people. However, this could be easily added later on (might even be marked as “easy” issue) because it would simply load from or store into settings.lp.

Actually I checked vscode as well, but I was confused by that UI :see_no_evil: You can assign multiple shortcuts, but the command is then listed multiple times. And when removing all shortcuts of an action, the whole action disappears from the list, which surprised me - afterwards it turned out that the action is actually not removed, but just moved to the bottom, but somehow this is still not the behavior I’d expect.

Anyway: I’m not sure yet how to handle identical shortcuts for multiple actions. Some software highlight such shortcuts as conflicting, suggesting the user should change them. But often the conflict does actually not exist due to different contexts.

Example: Ctrl+N can be used for the actions “New Project”, “New Sheet”, “New Vertex”, etc. Most of the time, they don’t conflict because only one of these actions will be available in a particular state of the focused window. I now wonder if all these actions should be handled separately regarding keyboard shortcuts, i.e. you could assign different shortcuts for them, but by default they will all have Ctrl+N. Or, if they all should be represented by only one, generic “New” action, enforcing the user to assign the same shortcut for all places where some kind of a “New …” action is used. At the moment I tend to go with option 1, but then IMHO it makes no sense to even highlight conflicting shortcuts since duplicate shortcuts are totally fine.

Yeah, sounds reasonable :+1:

You could make the context explicit, like in VSCode. In that case, you could detect conflicts in the same context, but not show a conflict if two identiacal keybindings use different contexts.