mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	refactor: use isMac and isWindows util funcs
This commit is contained in:
		| @@ -2,11 +2,11 @@ | ||||
|  | ||||
| import optionService from "./options.js"; | ||||
| import log from "./log.js"; | ||||
| import { isElectron as getIsElectron } from "./utils.js"; | ||||
| import { isElectron as getIsElectron, isMac as getIsMac } from "./utils.js"; | ||||
| import { KeyboardShortcut } from './keyboard_actions_interface.js'; | ||||
| import { t } from "i18next"; | ||||
|  | ||||
| const isMac = process.platform === "darwin"; | ||||
| const isMac = getIsMac(); | ||||
| const isElectron = getIsElectron(); | ||||
|  | ||||
| function getDefaultKeyboardActions() { | ||||
|   | ||||
| @@ -4,6 +4,7 @@ import { Request, Response } from "express"; | ||||
| import fs from "fs"; | ||||
| import dataDir from "./data_dir.js"; | ||||
| import cls from "./cls.js"; | ||||
| import { isWindows } from "./utils.js"; | ||||
|  | ||||
| if (!fs.existsSync(dataDir.LOG_DIR)) { | ||||
|     fs.mkdirSync(dataDir.LOG_DIR, 0o700); | ||||
| @@ -16,7 +17,7 @@ const MINUTE = 60 * SECOND; | ||||
| const HOUR = 60 * MINUTE; | ||||
| const DAY = 24 * HOUR; | ||||
|  | ||||
| const NEW_LINE = process.platform === "win32" ? '\r\n' : '\n'; | ||||
| const NEW_LINE = isWindows() ? '\r\n' : '\n'; | ||||
|  | ||||
| let todaysMidnight!: Date; | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import optionService from "./options.js"; | ||||
| import type { OptionMap } from "./options.js"; | ||||
| import appInfo from "./app_info.js"; | ||||
| import { randomSecureToken } from "./utils.js"; | ||||
| import { randomSecureToken, isWindows } from "./utils.js"; | ||||
| import log from "./log.js"; | ||||
| import dateUtils from "./date_utils.js"; | ||||
| import keyboardActions from "./keyboard_actions.js"; | ||||
| @@ -72,7 +72,7 @@ const defaultOptions: DefaultOption[] = [ | ||||
|     { name: 'revisionSnapshotTimeInterval', value: '600', isSynced: true }, | ||||
|     { name: 'revisionSnapshotNumberLimit', value: '-1', isSynced: true }, | ||||
|     { name: 'protectedSessionTimeout', value: '600', isSynced: true }, | ||||
|     { name: 'zoomFactor', value: process.platform === "win32" ? '0.9' : '1.0', isSynced: false }, | ||||
|     { name: 'zoomFactor', value: isWindows() ? '0.9' : '1.0', isSynced: false }, | ||||
|     { name: 'overrideThemeFonts', value: 'false', isSynced: false }, | ||||
|     { name: 'mainFontFamily', value: 'theme', isSynced: false }, | ||||
|     { name: 'mainFontSize', value: '100', isSynced: false }, | ||||
|   | ||||
| @@ -9,6 +9,7 @@ import cls from "./cls.js"; | ||||
| import keyboardActionsService from "./keyboard_actions.js"; | ||||
| import remoteMain from "@electron/remote/main/index.js"; | ||||
| import { App, BrowserWindow, BrowserWindowConstructorOptions, WebContents, ipcMain } from 'electron'; | ||||
| import { isMac, isWindows } from "./utils.js"; | ||||
|  | ||||
| import { fileURLToPath } from "url"; | ||||
| import { dirname } from "path"; | ||||
| @@ -115,14 +116,11 @@ async function createMainWindow(app: App) { | ||||
| function getWindowExtraOpts() { | ||||
|     const extraOpts: Partial<BrowserWindowConstructorOptions> = {}; | ||||
|  | ||||
|     const isMac = (process.platform === "darwin"); | ||||
|     const isWindows = (process.platform === "win32"); | ||||
|  | ||||
|     if (!optionService.getOptionBool('nativeTitleBarVisible')) { | ||||
|         if (isMac) { | ||||
|         if (isMac()) { | ||||
|             extraOpts.titleBarStyle = "hiddenInset"; | ||||
|             extraOpts.titleBarOverlay = true; | ||||
|         } else if (isWindows) { | ||||
|         } else if (isWindows()) { | ||||
|             extraOpts.titleBarStyle = "hidden"; | ||||
|             extraOpts.titleBarOverlay = true; | ||||
|         } else { | ||||
| @@ -132,7 +130,7 @@ function getWindowExtraOpts() { | ||||
|     } | ||||
|  | ||||
|     // Window effects (Mica) | ||||
|     if (optionService.getOptionBool('backgroundEffects') && isWindows) { | ||||
|     if (optionService.getOptionBool('backgroundEffects') && isWindows()) { | ||||
|         extraOpts.backgroundMaterial = "auto"; | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user