Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom keyboard shortcuts #818

Open
tiotrom opened this issue May 17, 2020 · 11 comments
Open

Custom keyboard shortcuts #818

tiotrom opened this issue May 17, 2020 · 11 comments
Assignees
Labels
feature This is a completely new feature for Zettlr. pinned Indicates this issue should not be automatically handled by the bots. priority:mid This issue has medium priority.

Comments

@tiotrom
Copy link

tiotrom commented May 17, 2020

I thought it could be handy to be able to add custom keyboard shortcuts for faster editing/writing. Cheers!

@nathanlesage nathanlesage added feature This is a completely new feature for Zettlr. pinned Indicates this issue should not be automatically handled by the bots. labels May 18, 2020
@bionicles
Copy link

this would be awesome because we could make Zettlr have keybinds like VS Code or Atom and make a more seamless transition between various editors

@nathanlesage nathanlesage self-assigned this Dec 19, 2021
@nathanlesage nathanlesage added the priority:mid This issue has medium priority. label Dec 19, 2021
@nathanlesage
Copy link
Member

There are quite a lot of thumbs-up on this issue. That is something I don't get notified by. :D

However, since a lot of people are beginning to more and more complain about the more and more keyboard shortcuts becoming more and more inaccessible because more complex, we should focus efforts on implementing that right now.

Basically, it's relatively easy to implement, shouldn't take me more than a few hours maybe over Christmas.

@nathanlesage nathanlesage pinned this issue Dec 19, 2021
@nathanlesage
Copy link
Member

Basically, it's relatively easy to implement, shouldn't take me more than a few hours maybe over Christmas.

That was a lie. I just found out Electron only implements the en-US ANSI keyboard layout. There is literally no support for anything else, no French, German, Italian, Swedish, etc. keys. Gosh, why is tech so US-centric?

@bilderbuchi
Copy link

bilderbuchi commented Dec 28, 2021

Gosh, why is tech so US-centric?

Why, indeed. I've just tried out Zettlr, and some of the shortcuts I can't even execute on my (QWERTZ/de) keyboard layout. 😝 For example, "File-Previous File" helpfully tells me that I have to press Ctrl+[. However, [ needs me to press AltGr, and Ctrl+AltGr+[ does not do anything (clicking the menu entry works).

Adjustable keyboard shortcuts would probably be useful (well, not for me, yet :D). Ideally, there are a couple of selectable predefined "maps" with applicable setttings corresponding to popular editors (e.g. VS Code, Notepad++,...) -- is there some plugin/package or so you can lean on? I would think that some other Electron-based editor has solved this problem before? CodeMirror?

@nathanlesage
Copy link
Member

Gosh, why is tech so US-centric?

Why, indeed. I've just tried out Zettlr, and some of the shortcuts I can't even execute on my (QWERTZ/de) keyboard layout. 😝 For example, "File-Previous File" helpfully tells me that I have to press Ctrl+[. However, [ needs me to press AltGr, and Ctrl+AltGr+[ does not do anything (clicking the menu entry works).

Adjustable keyboard shortcuts would probably be useful (well, not for me, yet :D). Ideally, there are a couple of selectable predefined "maps" with applicable setttings corresponding to popular editors (e.g. VS Code, Notepad++,...) -- is there some plugin/package or so you can lean on? I would think that some other Electron-based editor has solved this problem before? CodeMirror?

Other electron-based editors simply don't make use of so many keyboard shortcuts :D

With regard to de-DE keyboard layout: Have a look at this issue to see the mess that is Electron: electron/electron#32259

Without the Electron fixing whatever the hell it is they are doing there I can't introduce custom shortcuts, because I have literally no idea what I should be transforming the keyboard shortcuts you mean into something that will result in what you expect.

@bilderbuchi
Copy link

bilderbuchi commented Dec 29, 2021

Other electron-based editors simply don't make use of so many keyboard shortcuts :D

Erm, I guess you're pulling my leg? If not: what about Atom, VS Code?

Anyway, point well taken, and thanks for the link. Please don't understand my comment as a feature request, it was more meant as a confirmation that custom keyboard shortcuts would indeed be useful.

@nathanlesage
Copy link
Member

nathanlesage commented Dec 29, 2021

Erm, I guess you're pulling my leg? If not: what about Atom, VS Code?

I think they use the JavaScript directly and don't create a Menu. This feels a little bit like a hack, since it basically circumvents the Menus and listens for shortcuts directly in the renderer process. But the benefit is clear: You don't have all of these problems, since the JavaScript implementation gives us everything we need.

This is actually a good idea: On macOS we can leave everything as is, since it works. And for Windows and Linux, we can basically strip apart the keyboard shortcuts from the menu items, and instead implement something in the windows that listens for those shortcuts. Then we wouldn't need to wait for Electron to fix that.

Once that is in the clear, we can implement custom keyboard shortcuts (since then we do know what will happen, and I have even already created a shortcut selector which works perfectly fine).


EDIT: Note, I should clarify that when I speak of "keyboard shortcut" in this context, I actually mean the accelerators that can be assigned to menu items. Those accelerators are the troublemakers, keyboard shortcuts within the JavaScript code work perfectly fine.

@nathanlesage
Copy link
Member

Oh boy, I just searched the VSCode codebase for inspiration and I found this gem:

image

The whole management of accelerators that VSCode goes through just to enable accelerators is a gigantic monkey patch around Electron's limitations.

There is a lot for us to do, I fear :/

@joaocarvalhoopen
Copy link

I confirm also that in the Portuguese QWERTY keyboard Layout, on Linux, I can not do CTRL + [ and CTRL+ ] for next and previous open note navigation.

@bjohas
Copy link

bjohas commented Dec 27, 2022

I would be really interested in being able to change some of the defaut keyboard shortcuts to custom keyboard shortcuts, e.g. ctrl+= is quite common for zoom in (as opposed to ctrl+shift+=). Many thanks!

@p3sp12
Copy link

p3sp12 commented Aug 28, 2023

@bjohas
In that cases, you can use powershell on windows.
Other OS may have same functional applications.

@sensologica sensologica unpinned this issue Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This is a completely new feature for Zettlr. pinned Indicates this issue should not be automatically handled by the bots. priority:mid This issue has medium priority.
Projects
None yet
Development

No branches or pull requests

7 participants