mirror of
https://github.com/jiahaog/Nativefier
synced 2024-06-26 07:38:59 +02:00
b4ddd6865c
This PR adds an optional, customizable menu of predefined bookmarks. In addition to containing a list of bookmarks, this file customizes the name of the menu and (optionally) allows assigning keyboard shortcuts to bookmarks. It adds a new command-line flag, `--bookmarks-menu <string>`, which can be set as the path to a JSON file containing configuration for the bookmarks menu. Example of such a JSON file: ```json { "menuLabel": "Music", "bookmarks": [ { "title": "lofi.cafe", "url": "https://lofi.cafe/", "type": "link", "shortcut": "Cmd+1" }, { "title": "beats to relax/study to", "url": "https://www.youtube.com/watch?v=5qap5aO4i9A", "type": "link", "shortcut": "Cmd+2" }, { "type": "separator" }, { "title": "RÜFÜS DU SOL Live from Joshua Tree", "type": "link", "url": "https://www.youtube.com/watch?v=Zy4KtD98S2c" } ] } ``` ## Checks - [x] `npm run ci` passes ## Notes Compared to the fork linked in #1065, this PR: - adds no dependencies - doesn't currently support submenus (this should be easy enough to add, but I didn't need it) ## Screenshot <img width="853" alt="screenshot" src="https://user-images.githubusercontent.com/102904/115882015-5493a800-a41a-11eb-85ef-a190f3dbfe76.png">
66 lines
1.6 KiB
TypeScript
66 lines
1.6 KiB
TypeScript
import * as electronPackager from 'electron-packager';
|
|
|
|
export interface ElectronPackagerOptions extends electronPackager.Options {
|
|
targetUrl: string;
|
|
platform: string;
|
|
}
|
|
|
|
export interface AppOptions {
|
|
packager: ElectronPackagerOptions;
|
|
nativefier: {
|
|
accessibilityPrompt: boolean;
|
|
alwaysOnTop: boolean;
|
|
backgroundColor: string;
|
|
basicAuthPassword: string;
|
|
basicAuthUsername: string;
|
|
bookmarksMenu: string;
|
|
bounce: boolean;
|
|
browserwindowOptions: any;
|
|
clearCache: boolean;
|
|
counter: boolean;
|
|
crashReporter: string;
|
|
disableContextMenu: boolean;
|
|
disableDevTools: boolean;
|
|
disableGpu: boolean;
|
|
disableOldBuildWarning: boolean;
|
|
diskCacheSize: number;
|
|
enableEs3Apis: boolean;
|
|
fastQuit: boolean;
|
|
fileDownloadOptions: any;
|
|
flashPluginDir: string;
|
|
fullScreen: boolean;
|
|
globalShortcuts: any;
|
|
hideWindowFrame: boolean;
|
|
ignoreCertificate: boolean;
|
|
ignoreGpuBlacklist: boolean;
|
|
inject: string[];
|
|
insecure: boolean;
|
|
internalUrls: string;
|
|
blockExternalUrls: boolean;
|
|
maximize: boolean;
|
|
nativefierVersion: string;
|
|
processEnvs: string;
|
|
proxyRules: string;
|
|
showMenuBar: boolean;
|
|
singleInstance: boolean;
|
|
titleBarStyle: string;
|
|
tray: string | boolean;
|
|
userAgent: string;
|
|
verbose: boolean;
|
|
versionString: string;
|
|
width: number;
|
|
height: number;
|
|
minWidth: number;
|
|
minHeight: number;
|
|
maxWidth: number;
|
|
maxHeight: number;
|
|
x: number;
|
|
y: number;
|
|
zoom: number;
|
|
};
|
|
}
|
|
|
|
export type NativefierOptions = Partial<
|
|
AppOptions['packager'] & AppOptions['nativefier']
|
|
>;
|