-
-
Notifications
You must be signed in to change notification settings - Fork 154
Added feature to export/import menus! #1230
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
base: main
Are you sure you want to change the base?
Conversation
|
This looks quite good now! I think there are two things which we could improve:
|
|
I dont know what we can do abot redability of errors, I changed layout of error window and applied your 1 suggestion |
|
Any updates on this? |
Schneegans
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it works quite well now! I just added some more suggestions below 😄
src/main/app.ts
Outdated
| if (menuIndex < 0 || menuIndex >= settings.menus.length) { | ||
| await dialog.showMessageBox(this.settingsWindow, { | ||
| type: 'error', | ||
| title: i18next.t('settings.export-menu-error-title', 'Failed to export menu'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is no need to show a translatable message box here. This should only happen on a coding error, not on user error. So a simple console.error(...) should be sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
src/main/app.ts
Outdated
| // Convert the exported root into a full MENU object so defaults (like | ||
| // centered/anchored/hoverMode and shortcut fields) are applied. | ||
| const validatedMenu = MENU_SCHEMA_V1.parse({ root: exported.menu }, { reportInput: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this second parse should not be necessary. The first parsing in the lines above this already fully parses the menu. You can just access it with exported.menu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXPORTED_MENU_SCHEMA_V1 only validates a MenuItem, and the second parse is required to construct a full Menu object and apply defaults.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. You are right!
src/main/app.ts
Outdated
| await dialog.showMessageBox(this.settingsWindow, { | ||
| type: 'error', | ||
| title: i18next.t('settings.import-menu-error-title', 'Failed to import menu'), | ||
| message: 'The selected file could not be imported. It does not contain a valid Kando exported menu.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be translatable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added to translations
src/main/app.ts
Outdated
|
|
||
| await dialog.showMessageBox(this.settingsWindow, { | ||
| type: 'error', | ||
| title: i18next.t('settings.import-menu-error-title', 'Failed to import menu'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually do not add fallbacks in the code.
| title: i18next.t('settings.import-menu-error-title', 'Failed to import menu'), | |
| title: i18next.t('settings.import-menu-error-title'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
| // SPDX-License-Identifier: MIT | ||
|
|
||
| import { ipcRenderer, OpenDialogOptions, webFrame } from 'electron'; | ||
| import { ipcRenderer, OpenDialogOptions, SaveDialogOptions, webFrame } from 'electron'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change could be undone, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point!
|
Okay, I’ll fix your suggestions later today. |
Co-authored-by: Simon Schneegans <code@simonschneegans.de>
Merge `main` into `feature/export-import-menus`
|
More likely 2.3.0, I guess. Then we can properly advertise and test it. I am also experimenting with another new 2.3.0 feature which would fit quite well: Screencast.From.2026-01-10.20-28-22.mp4I do not like too much how there are lots of buttons now in the floating button bar at the bottom. Maybe we can use Kando more often in... Kando 😉 |
|
Pretty cool idea! It will entertain users to use Kando. |
|
Any else suggestions on code? |
Schneegans
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think code-wise, this looks great! But as mentioned before, I will wait with the merge until 2.2.0 is released. Thank you so much!
|
Okay, perfect! |
No description provided.