本文整理匯總了TypeScript中electron.systemPreferences類的典型用法代碼示例。如果您正苦於以下問題:TypeScript systemPreferences類的具體用法?TypeScript systemPreferences怎麽用?TypeScript systemPreferences使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了systemPreferences類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
ipcMain.on('set-vibrancy', () => {
mainWindow.setVibrancy('sidebar');
if (config.get('followSystemAppearance')) {
systemPreferences.setAppLevelAppearance(systemPreferences.isDarkMode() ? 'dark' : 'light');
} else {
systemPreferences.setAppLevelAppearance(config.get('darkMode') ? 'dark' : 'light');
}
});
示例2: getBackgroundColor
export function getBackgroundColor(stateService: IStateService): string {
if (isWindows && systemPreferences.isInvertedColorScheme()) {
return DEFAULT_BG_HC_BLACK;
}
let background = stateService.getItem<string>(THEME_BG_STORAGE_KEY, null);
if (!background) {
let baseTheme: string;
if (isWindows && systemPreferences.isInvertedColorScheme()) {
baseTheme = 'hc-black';
} else {
baseTheme = stateService.getItem<string>(THEME_STORAGE_KEY, 'vs-dark').split(' ')[0];
}
background = (baseTheme === 'hc-black') ? DEFAULT_BG_HC_BLACK : (baseTheme === 'vs' ? DEFAULT_BG_LIGHT : DEFAULT_BG_DARK);
}
if (isMacintosh && background.toUpperCase() === DEFAULT_BG_DARK) {
background = '#171717'; // https://github.com/electron/electron/issues/5150
}
return background;
}
示例3: makeDefaultConfig
function makeDefaultConfig() {
const IsDarkMode = process.platform === 'darwin' && systemPreferences.isDarkMode();
const menubarBroken = process.platform === 'win32';
return {
hot_key: 'CmdOrCtrl+Shift+S',
icon_color: IsDarkMode ? 'white' : 'black',
always_on_top: false,
normal_window: menubarBroken,
zoom_factor: 0.9,
home_url: 'https://mobile.twitter.com',
notification: true,
refresh_on_sleep: true,
refresh_threshold_memory_mb: 500,
plugins: [],
keymaps: {
/* tslint:disable:object-literal-key-quotes */
j: 'next-tweet',
k: 'previous-tweet',
esc: 'unfocus-tweet',
f: 'scroll-down-page',
b: 'scroll-up-page',
t: 'scroll-up-to-top',
'1': 'switch-home-timeline',
'2': 'switch-notifications',
'3': 'switch-direct-messages',
'4': 'switch-search',
n: 'new-tweet',
enter: 'reply-tweet',
R: 'retweet-tweet',
Q: 'quote-tweet',
L: 'like-tweet',
i: 'open-images',
I: 'open-images-in-browser',
o: 'open-tweet',
l: 'open-links',
u: 'show-user',
backspace: 'browser-go-back',
'ctrl+enter': 'send-tweet',
'mod+plus': 'zoom-in',
'mod+-': 'zoom-out',
'mod+shift+l': 'last-account',
'mod+shift+n': 'next-account',
'mod+shift+p': 'previous-account',
/* tslint:enable:object-literal-key-quotes */
},
accounts: null,
} as Config;
}