UNPKG

4.2 kBJavaScriptView Raw
1"use strict";
2// *****************************************************************************
3// Copyright (C) 2021 Ericsson and others.
4//
5// This program and the accompanying materials are made available under the
6// terms of the Eclipse Public License v. 2.0 which is available at
7// http://www.eclipse.org/legal/epl-2.0.
8//
9// This Source Code may also be made available under the following Secondary
10// Licenses when the conditions for such availability set forth in the Eclipse
11// Public License v. 2.0 are satisfied: GNU General Public License, version 2
12// with the GNU Classpath Exception which is available at
13// https://www.gnu.org/software/classpath/license.html.
14//
15// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16// *****************************************************************************
17Object.defineProperty(exports, "__esModule", { value: true });
18exports.bindWindowPreferences = exports.createElectronWindowPreferences = exports.ElectronWindowPreferences = exports.ElectronWindowPreferenceContribution = exports.ElectronWindowConfiguration = exports.electronWindowPreferencesSchema = exports.ZoomLevel = void 0;
19const nls_1 = require("../../common/nls");
20const preferences_1 = require("../../browser/preferences");
21const common_1 = require("../../common");
22var ZoomLevel;
23(function (ZoomLevel) {
24 ZoomLevel.DEFAULT = 0;
25 // copied from https://github.com/microsoft/vscode/blob/dda96b69bfc63f309e60cfc5f98cb863c46b32ac/src/vs/workbench/electron-sandbox/actions/windowActions.ts#L47-L48
26 ZoomLevel.MIN = -8;
27 ZoomLevel.MAX = 9;
28 // amount to increment or decrement the window zoom level.
29 ZoomLevel.VARIATION = 0.5;
30})(ZoomLevel = exports.ZoomLevel || (exports.ZoomLevel = {}));
31exports.electronWindowPreferencesSchema = {
32 type: 'object',
33 properties: {
34 'window.zoomLevel': {
35 'type': 'number',
36 'default': ZoomLevel.DEFAULT,
37 'minimum': ZoomLevel.MIN,
38 'maximum': ZoomLevel.MAX,
39 'scope': 'application',
40 // eslint-disable-next-line max-len
41 'description': nls_1.nls.localizeByDefault('Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1) or below (e.g. -1) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity.')
42 },
43 'window.titleBarStyle': {
44 type: 'string',
45 enum: ['native', 'custom'],
46 default: common_1.isWindows ? 'custom' : 'native',
47 scope: 'application',
48 // eslint-disable-next-line max-len
49 description: nls_1.nls.localizeByDefault('Adjust the appearance of the window title bar. On Linux and Windows, this setting also affects the application and context menu appearances. Changes require a full restart to apply.'),
50 included: !common_1.isOSX
51 },
52 }
53};
54class ElectronWindowConfiguration {
55}
56exports.ElectronWindowConfiguration = ElectronWindowConfiguration;
57exports.ElectronWindowPreferenceContribution = Symbol('ElectronWindowPreferenceContribution');
58exports.ElectronWindowPreferences = Symbol('ElectronWindowPreferences');
59function createElectronWindowPreferences(preferences, schema = exports.electronWindowPreferencesSchema) {
60 return (0, preferences_1.createPreferenceProxy)(preferences, schema);
61}
62exports.createElectronWindowPreferences = createElectronWindowPreferences;
63function bindWindowPreferences(bind) {
64 bind(exports.ElectronWindowPreferences).toDynamicValue(ctx => {
65 const preferences = ctx.container.get(preferences_1.PreferenceService);
66 const contribution = ctx.container.get(exports.ElectronWindowPreferenceContribution);
67 return createElectronWindowPreferences(preferences, contribution.schema);
68 }).inSingletonScope();
69 bind(exports.ElectronWindowPreferenceContribution).toConstantValue({ schema: exports.electronWindowPreferencesSchema });
70 bind(preferences_1.PreferenceContribution).toService(exports.ElectronWindowPreferenceContribution);
71}
72exports.bindWindowPreferences = bindWindowPreferences;
73//# sourceMappingURL=electron-window-preferences.js.map
\No newline at end of file