From c8b0c0b4b128d30399cc96e898c7d2d58c7f3a2d Mon Sep 17 00:00:00 2001 From: rhysd Date: Sat, 22 Oct 2016 11:41:09 +0900 Subject: [PATCH] github-electron: Update for version 1.4.4 --- electron/github-electron-main-tests.ts | 10 +++ electron/github-electron.d.ts | 90 +++++++++++++++++++++++++- 2 files changed, 99 insertions(+), 1 deletion(-) diff --git a/electron/github-electron-main-tests.ts b/electron/github-electron-main-tests.ts index 966465ed3a..7bbbfa83c1 100644 --- a/electron/github-electron-main-tests.ts +++ b/electron/github-electron-main-tests.ts @@ -303,6 +303,10 @@ if (app.isAccessibilitySupportEnabled()) { } app.setLoginItemSettings({openAtLogin: true, openAsHidden: false}); console.log(app.getLoginItemSettings().wasOpenedAtLogin); +app.setAboutPanelOptions({ + applicationName: 'Test', + version: '1.2.3' +}); var window = new BrowserWindow(); window.setProgressBar(0.5); @@ -359,6 +363,12 @@ if (process.platform !== 'win32' || systemPreferences.isAeroGlassEnabled()) { browserOptions.frame = false; } +if (process.platform === 'win32') { + systemPreferences.on('color-changed', () => { console.log('color changed'); }); + systemPreferences.on('inverted-color-scheme-changed', (_, inverted) => console.log(inverted ? 'inverted' : 'not inverted')); + console.log('Color for menu is', systemPreferences.getColor('menu')); +} + // Create the window. var win = new BrowserWindow(browserOptions); diff --git a/electron/github-electron.d.ts b/electron/github-electron.d.ts index ca073ebf58..f87b50b362 100644 --- a/electron/github-electron.d.ts +++ b/electron/github-electron.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Electron v1.4.3 +// Type definitions for Electron v1.4.4 // Project: http://electron.atom.io/ // Definitions by: jedmao , rhysd , Milan Burda // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -423,6 +423,13 @@ declare namespace Electron { * Note: This API is only available on macOS and Windows. */ setLoginItemSettings(settings: LoginItemSettings): void; + /** + * Set the about panel options. This will override the values defined in the app's .plist file. + * See the Apple docs for more details. + * + * Note: This API is only available on macOS. + */ + setAboutPanelOptions(options: AboutPanelOptions): void; commandLine: CommandLine; /** * Note: This API is only available on macOS. @@ -684,6 +691,29 @@ declare namespace Electron { restoreState?: boolean; } + interface AboutPanelOptions { + /** + * The app's name. + */ + applicationName?: string; + /** + * The app's version. + */ + applicationVersion?: string; + /** + * Copyright information. + */ + copyright?: string; + /** + * Credit information. + */ + credits?: string; + /** + * The app's build version number. + */ + version?: string; + } + // https://github.com/electron/electron/blob/master/docs/api/auto-updater.md /** @@ -3547,6 +3577,38 @@ declare namespace Electron { // https://github.com/electron/electron/blob/master/docs/api/system-preferences.md + type SystemColor = + '3d-dark-shadow' | // Dark shadow for three-dimensional display elements. + '3d-face' | // Face color for three-dimensional display elements and for dialog box backgrounds. + '3d-highlight' | // Highlight color for three-dimensional display elements. + '3d-light' | // Light color for three-dimensional display elements. + '3d-shadow' | // Shadow color for three-dimensional display elements. + 'active-border' | // Active window border. + 'active-caption' | // Active window title bar. Specifies the left side color in the color gradient of an active window's title bar if the gradient effect is enabled. + 'active-caption-gradient' | // Right side color in the color gradient of an active window's title bar. + 'app-workspace' | // Background color of multiple document interface (MDI) applications. + 'button-text' | // Text on push buttons. + 'caption-text' | // Text in caption, size box, and scroll bar arrow box. + 'desktop' | // Desktop background color. + 'disabled-text' | // Grayed (disabled) text. + 'highlight' | // Item(s) selected in a control. + 'highlight-text' | // Text of item(s) selected in a control. + 'hotlight' | // Color for a hyperlink or hot-tracked item. + 'inactive-border' | // Inactive window border. + 'inactive-caption' | // Inactive window caption. Specifies the left side color in the color gradient of an inactive window's title bar if the gradient effect is enabled. + 'inactive-caption-gradient' | // Right side color in the color gradient of an inactive window's title bar. + 'inactive-caption-text' | // Color of text in an inactive caption. + 'info-background' | // Background color for tooltip controls. + 'info-text' | // Text color for tooltip controls. + 'menu' | // Menu background. + 'menu-highlight' | // The color used to highlight menu items when the menu appears as a flat menu. + 'menubar' | // The background color for the menu bar when menus appear as flat menus. + 'menu-text' | // Text in menus. + 'scrollbar' | // Scroll bar gray area. + 'window' | // Window background. + 'window-frame' | // Window frame. + 'window-text'; // Text in windows. + /** * Get system preferences. */ @@ -3555,6 +3617,20 @@ declare namespace Electron { * Note: This is only implemented on Windows. */ on(event: 'accent-color-changed', listener: (event: Event, newColor: string) => void): this; + /** + * Note: This is only implemented on Windows. + */ + on(event: 'color-changed', listener: (event: Event) => void): this; + /** + * Note: This is only implemented on Windows. + */ + on(event: 'inverted-color-scheme-changed', listener: ( + event: Event, + /** + * @param invertedColorScheme true if an inverted color scheme, such as a high contrast theme, is being used, false otherwise. + */ + invertedColorScheme: boolean + ) => void): this; on(event: string, listener: Function): this; /** * @returns Whether the system is in Dark Mode. @@ -3621,6 +3697,18 @@ declare namespace Electron { * Note: This is only implemented on Windows. */ getAccentColor(): string; + /** + * @returns true if an inverted color scheme, such as a high contrast theme, is active, false otherwise. + * + * Note: This is only implemented on Windows. + */ + isInvertedColorScheme(): boolean; + /** + * @returns The system color setting in RGB hexadecimal form (#ABCDEF). See the Windows docs for more details. + * + * Note: This is only implemented on Windows. + */ + getColor(color: SystemColor): string; } // https://github.com/electron/electron/blob/master/docs/api/tray.md