refactor: add show manager shortcut plus refactoring #419
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Extracted from and refactored upon #370.
This PR does the following:
show_manager
shortcut for showing (and focusing) the manager window.shortcuts.rs
, making a better macro to generate the implementations. Now each time there are only two places to modify in the backend: add an entry forShortcuts
insettings.rs
, then add akey => listener
pair inimpl_shortcuts!
inshortcuts.rs
, and two places in the frontend: add the entry forShortcuts
intypes/backend/settings.ts
, then make the UI inmanager/components/Settings/index.tsx
.bincode
withserde_json
for the settings file. The reason is that,bincode
seems to do well only when the structure for deserialization is not broken, otherwisebincode
may directly panic (due to excessive memory allocation, etc). Why this happens? We may change the settings structure between versions. For adding fields we can put#[serde(default)]
to avoid errors. For removing field,serde_json
automatically ignores redundant stuff (it seems so). For changing fields, we can make some kind of deprecation cycle.bincode
does not seem to be flexible enough when dealing with these. Also our settings won't be so huge that serialization/deserialization performance differ a lot, sosettings.json
would be just fine.