mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-18 23:44:59 +01:00
cecea312c6
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
71 lines
2.1 KiB
TypeScript
71 lines
2.1 KiB
TypeScript
/*
|
|
Copyright 2022-2024 New Vector Ltd.
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
|
Please see LICENSE files in the repository root for full details.
|
|
*/
|
|
|
|
import * as tray from "./tray.js";
|
|
|
|
interface Setting {
|
|
read(): Promise<any>;
|
|
write(value: any): Promise<void>;
|
|
}
|
|
|
|
export const Settings: Record<string, Setting> = {
|
|
"Electron.autoLaunch": {
|
|
async read(): Promise<any> {
|
|
return global.launcher.isEnabled();
|
|
},
|
|
async write(value: any): Promise<void> {
|
|
if (value) {
|
|
return global.launcher.enable();
|
|
} else {
|
|
return global.launcher.disable();
|
|
}
|
|
},
|
|
},
|
|
"Electron.warnBeforeExit": {
|
|
async read(): Promise<any> {
|
|
return global.store.get("warnBeforeExit", true);
|
|
},
|
|
async write(value: any): Promise<void> {
|
|
global.store.set("warnBeforeExit", value);
|
|
},
|
|
},
|
|
"Electron.alwaysShowMenuBar": {
|
|
// not supported on macOS
|
|
async read(): Promise<any> {
|
|
return !global.mainWindow!.autoHideMenuBar;
|
|
},
|
|
async write(value: any): Promise<void> {
|
|
global.store.set("autoHideMenuBar", !value);
|
|
global.mainWindow!.autoHideMenuBar = !value;
|
|
global.mainWindow!.setMenuBarVisibility(value);
|
|
},
|
|
},
|
|
"Electron.showTrayIcon": {
|
|
// not supported on macOS
|
|
async read(): Promise<any> {
|
|
return tray.hasTray();
|
|
},
|
|
async write(value: any): Promise<void> {
|
|
if (value) {
|
|
// Create trayIcon icon
|
|
tray.create(global.trayConfig);
|
|
} else {
|
|
tray.destroy();
|
|
}
|
|
global.store.set("minimizeToTray", value);
|
|
},
|
|
},
|
|
"Electron.enableHardwareAcceleration": {
|
|
async read(): Promise<any> {
|
|
return !global.store.get("disableHardwareAcceleration", false);
|
|
},
|
|
async write(value: any): Promise<void> {
|
|
global.store.set("disableHardwareAcceleration", !value);
|
|
},
|
|
},
|
|
};
|