diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index e88926d58..5d3060e4b 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -166,6 +166,10 @@ var dockMenu = Menu.buildFromTemplate([ }, ]); app.dock.setMenu(dockMenu); +app.dock.setBadge('foo'); +var id = app.dock.bounce('informational'); +app.dock.cancelBounce(id); +app.dock.setIcon('/path/to/icon.png'); app.setUserTasks([ { diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 4351b5aa1..d5ca18690 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1048,7 +1048,7 @@ declare module Electron { * Note: This API is only available on Windows. */ setUserTasks(tasks: Task[]): void; - dock: BrowserWindow; + dock: Dock; commandLine: CommandLine; /** * This method makes your application a Single Instance Application instead of allowing @@ -1075,6 +1075,64 @@ declare module Electron { appendArgument(value: any): void; } + interface Dock { + /** + * When critical is passed, the dock icon will bounce until either the + * application becomes active or the request is canceled. + * + * When informational is passed, the dock icon will bounce for one second. + * The request, though, remains active until either the application becomes + * active or the request is canceled. + * + * Note: This API is only available on Mac. + * @param type Can be critical or informational, the default is informational. + * @returns An ID representing the request + */ + bounce(type?: string): number; + /** + * Cancel the bounce of id. + * + * Note: This API is only available on Mac. + */ + cancelBounce(id: number): void; + /** + * Sets the string to be displayed in the dock’s badging area. + * + * Note: This API is only available on Mac. + */ + setBadge(text: string): void; + /** + * Returns the badge string of the dock. + * + * Note: This API is only available on Mac. + */ + getBadge(): string; + /** + * Hides the dock icon. + * + * Note: This API is only available on Mac. + */ + hide(): void; + /** + * Shows the dock icon. + * + * Note: This API is only available on Mac. + */ + show(): void; + /** + * Sets the application dock menu. + * + * Note: This API is only available on Mac. + */ + setMenu(menu: Menu): void; + /** + * Sets the image associated with this dock icon. + * + * Note: This API is only available on Mac. + */ + setIcon(icon: NativeImage | string): void; + } + interface Task { /** * Path of the program to execute, usually you should specify process.execPath @@ -1106,57 +1164,7 @@ declare module Electron { */ iconIndex?: number; commandLine?: CommandLine; - dock?: { - /** - * When critical is passed, the dock icon will bounce until either the - * application becomes active or the request is canceled. - * - * When informational is passed, the dock icon will bounce for one second. - * The request, though, remains active until either the application becomes - * active or the request is canceled. - * - * Note: This API is only available on Mac. - * @param type Can be critical or informational, the default is informational. - * @returns An ID representing the request - */ - bounce(type?: string): any; - /** - * Cancel the bounce of id. - * - * Note: This API is only available on Mac. - */ - cancelBounce(id: number): void; - /** - * Sets the string to be displayed in the dock’s badging area. - * - * Note: This API is only available on Mac. - */ - setBadge(text: string): void; - /** - * Returns the badge string of the dock. - * - * Note: This API is only available on Mac. - */ - getBadge(): string; - /** - * Hides the dock icon. - * - * Note: This API is only available on Mac. - */ - hide(): void; - /** - * Shows the dock icon. - * - * Note: This API is only available on Mac. - */ - show(): void; - /** - * Sets the application dock menu. - * - * Note: This API is only available on Mac. - */ - setMenu(menu: Menu): void; - }; + dock?: Dock; } class AutoUpdater implements NodeJS.EventEmitter { @@ -1225,7 +1233,7 @@ declare module Electron { filters?: { name: string; extensions: string[]; - }[] + }[]; } /**