paperlib
paperlib copied to clipboard
[Feature Request] Support more hotkeys
Describe your feature request ... 支持更多快捷键,比如delete删除、ctrl+f查找等。
@charlieJ107 please investigate this issue. Let's first add delete
. ctrl+f
is unnecessary as we have a new command panel in 3.0.
Currently, in the hotkey tab of the preference view, we use multiple <select>
to do the hotkey binding. It would be better to implement a new Vue component for this:
- click this component to activate
key-binding
, and listen to any key pressing now. - record and show the user's keyboard pressing.
- validate the hotkey
- emit an event if it is a valid hotkey.
If the key-binding
is activated, I think we should disable all other hotkeys registered in the menuService
:
await PLMainAPI.menuService.disableAll()
You can just implement the functionality of this component and leave the style design to me if you don't know how to make it consistent with other UI styles.
Fixing with #364
Do we have a hotkey for saving metadata edits? It's tedious to click the "save" button with the mouse every time.
Do we have a hotkey for saving metadata edits? It's tedious to click the "save" button with the mouse every time.
My understanding is the changes are saved in real time because we're using Realm to store metadata. The metadata will be saved and sync (if applicable) as soon as you make the change. @GeoffreyChen777 Would you mind confirm this?
@charlieJ107 He requests a hotkey to save the metadata and close the editing window.
Currently, the metadata will be updated once the user clicks the Save
button.
@chen-yingfa I will add a hotkey 'cmd+s' for this in the next beta.
@igoogolx would you mind taking this issue as @charlieJ107 seems to be busy recently?
related PR #364
@igoogolx would you mind taking this issue as @charlieJ107 seems to be busy recently?
related PR #364
Sure. I will take it.
@igoogolx would you mind taking this issue as @charlieJ107 seems to be busy recently? related PR #364
Sure. I will take it.
I'll make a catch-up commit on the #364 so you can directly start to develop new hotkeys settings feature
@igoogolx would you mind taking this issue as @charlieJ107 seems to be busy recently? related PR #364
Sure. I will take it.
I'll make a catch-up commit on the #364 so you can directly start to develop new hotkeys settings feature
Thanks.
Could you plz grant me permission to push the code? I found that I don't have the permission. @GeoffreyChen777
I have implemented most of the features. However, there are still some problems. You can pull my code from the branch to check the features. @GeoffreyChen777
- There is a conflict with the global shortcuts. I mean that we can disable the
menuService
. However, there is no way to disable theglobalShortcut
from the render process now. I want to implement that. The problem is where we put the code.windowProcessManagementService
? - What are the rules to validate the hotkey? Currently, I only check if it has three keys. https://github.com/Future-Scholars/paperlib/blob/b36abd30e53eeaeaee5ee8fb33074bcd05301805/app/renderer/ui/preference-view/components/hotkey-options.vue#L39
@igoogolx
- About the rules:
- we have three slots:
modifier(ctrl/cmd)
,shift
,A-Z...
- if we use
shift
, we must usemodifier
.shift+key
is invalid. -
modifier+key
is valid. - Some keys can be used without the modifier, such as
Enter, Space, Backspace, F1-12
. For others, Let's require amodifier
mandatorily.
- About globalShortcut. Currently, we have only one globalShortcut:
cmd+shift+i
to open the Quick Reference plugin window. TBH, I think the design of the shortcut service is a bit messy.
Currently, we have two services for shortcuts:
-
PLMainAPI.menuService
-
PLAPI.shourtcutService
The first one is based on the Electron. The second one is based on the HTML.
In the menuService
, we have a method disableAll
. The reason is that, we need to disable the menu shortcuts in certain cases, such as in <input>
.
However, these two services make shortcut management messier and messier and cause many bugs.
I have a proposal want to discuss with you: remove most shortcuts managed by the menuService
. We use shourtcutService
to manage most shortcuts.
shourtcutService
has a method registerInInputField
which makes it easy to handle shortcuts in <input>
.
Looking forward to your comments.
About the shortcut component. It looks good. But I have a suggestion: when we click the input box, it would be better to remove the previous text and show press any key
or something like that.
Agree with refactoring shortcutService
. But I suggest that we do it in another PR. Here I will put the code about globalShortcut
in shourtcutService
.
You can file a new issue about the refactoring and assign it to me. @GeoffreyChen777
For the rules:
Can we simplify the rules? I suggest:
- The length of keys must be 2 or 3.
- Only shortcuts that start with Ctrl or Cmd, Alt or Option, or Shift are valid. @GeoffreyChen777
For the rules:
Can we simplify the rules? I suggest:
- The length of keys must be 2 or 3.
- Only shortcuts that start with Ctrl or Cmd, Alt or Option, or Shift are valid. @GeoffreyChen777
At least we need Space for preview, enter for open, Backspace for delete.
For the rules: Can we simplify the rules? I suggest:
- The length of keys must be 2 or 3.
- Only shortcuts that start with Ctrl or Cmd, Alt or Option, or Shift are valid. @GeoffreyChen777
At least we need Space for preview, enter for open, Backspace for delete.
I think these shortcuts should be a default and can't be changed by users.
For the rules: Can we simplify the rules? I suggest:
- The length of keys must be 2 or 3.
- Only shortcuts that start with Ctrl or Cmd, Alt or Option, or Shift are valid. @GeoffreyChen777
At least we need Space for preview, enter for open, Backspace for delete.
I think these shortcuts should be a default and can't be changed by users.
It’s changeable in previous versions. We have to be backward compatible.
For the rules: Can we simplify the rules? I suggest:
- The length of keys must be 2 or 3.
- Only shortcuts that start with Ctrl or Cmd, Alt or Option, or Shift are valid. @GeoffreyChen777
At least we need Space for preview, enter for open, Backspace for delete.
I think these shortcuts should be a default and can't be changed by users.
It’s changeable in previous versions. We have to be backward compatible.
Make sense, will keep it. Here are the rules:
- If it's a single key, only
Enter, Space, Backspace, F1-12
are valid. - If it has 2 or 3 keys, only shortcuts that start with Ctrl or Cmd, Alt or Option, or Shift are valid.
- Others are invalid. @GeoffreyChen777
Implemented.