8000 Adding support of exporting/importing menus by yar2000T · Pull Request #973 · kando-menu/kando · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Adding support of exporting/importing menus #973

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

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"select-file": "Select a file",
"select-directory": "Select a directory"
},
"import-menu-button": "Import menu",
"export-menu-button": "Export menu",
"add-tags-placeholder": "Add tags…",
"about-dialog": {
"title": "About Kando",
Expand Down Expand Up @@ -115,7 +117,10 @@
"reload-sound-theme": "Reload sound theme",
"dev-tools-note": "Kando uses two windows: One for the menu and one for the settings. You can open the development tools to inspect both windows separately.",
"menu-window-dev-tools": "Inspect menu",
"settings-window-dev-tools": "Inspect settings"
"settings-window-dev-tools": "Inspect settings",
"export-import-note": "You can export or import menus to share with community",
"export-menus": "Export menus",
"import-menus": "Import menus"
},
"introduction-dialog": {
"slide1-title": "Kando offers a unique and efficient way for interacting with your computer.",
Expand Down
14 changes: 14 additions & 0 deletions src/@types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,17 @@ declare const cIsMac: boolean;
declare const cIsWindows: boolean;
declare const cIsLinux: boolean;
declare const cLocales: string[];

/* eslint-disable */
type CommonWindowApiType = typeof COMMON_WINDOW_API;
type SettingsWindowApiType = typeof SETTINGS_WINDOW_API;

declare const cIsLinux: boolean;

declare global {
interface Window {
COMMON_WINDOW_API: CommonWindowApiType;
SETTINGS_WINDOW_API: SettingsWindowApiType;
}
}

24 changes: 19 additions & 5 deletions src/common/icon-themes/icon-theme-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
// SPDX-License-Identifier: MIT

import { WindowWithAPIs } from '../common-window-api';
declare const window: WindowWithAPIs;
// Conditionally declare window type when in renderer context
declare const window: WindowWithAPIs | undefined;

import { SimpleIconsTheme } from './simple-icons-theme';
import { SimpleIconsColoredTheme } from './simple-icons-colored-theme';
Expand Down Expand Up @@ -98,13 +99,26 @@ export class IconThemeRegistry {
this.iconThemes.set('base64', new Base64Theme());

// Add an icon theme for all icon themes in the user's icon theme directory.
const info = await window.commonAPI.getIconThemes();
this._userIconThemeDirectory = info.userIconDirectory;
for (const theme of info.fileIconThemes) {
this.iconThemes.set(theme.name, new FileIconTheme(theme));
// Only execute this in renderer process where window.commonAPI is available
if (typeof window !== 'undefined' && window.commonAPI) {
window.commonAPI.getIconThemes().then((info) => {
this._userIconThemeDirectory = info.userIconDirectory;
for (const theme of info.fileIconThemes) {
this.iconThemes.set(theme.name, new FileIconTheme(theme));
}
});
}
}

/**
* Use this method to get the singleton instance of this class.
*
* @returns The singleton instance of this class.
*/
public static getInstance(): IconThemeRegistry {
return IconThemeRegistry.instance;
}

/**
* Use this method to get the directory where the user's icon themes are stored.
*
Expand Down
Loading
Loading
0