本文整理汇总了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;
}