mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	refactor(server/utils): isMac/isWin - replace fn with boolean
those values cannot change during runtime, => there is no need to have these checks as dynamic function, instead just export the boolean value directly
This commit is contained in:
		@@ -2,11 +2,10 @@
 | 
			
		||||
 | 
			
		||||
import optionService from "./options.js";
 | 
			
		||||
import log from "./log.js";
 | 
			
		||||
import { isElectron as getIsElectron, isMac as getIsMac } from "./utils.js";
 | 
			
		||||
import { isElectron as getIsElectron, isMac } from "./utils.js";
 | 
			
		||||
import type { KeyboardShortcut } from "./keyboard_actions_interface.js";
 | 
			
		||||
import { t } from "i18next";
 | 
			
		||||
 | 
			
		||||
const isMac = getIsMac();
 | 
			
		||||
const isElectron = getIsElectron();
 | 
			
		||||
 | 
			
		||||
function getDefaultKeyboardActions() {
 | 
			
		||||
 
 | 
			
		||||
@@ -17,7 +17,7 @@ const MINUTE = 60 * SECOND;
 | 
			
		||||
const HOUR = 60 * MINUTE;
 | 
			
		||||
const DAY = 24 * HOUR;
 | 
			
		||||
 | 
			
		||||
const NEW_LINE = isWindows() ? "\r\n" : "\n";
 | 
			
		||||
const NEW_LINE = isWindows ? "\r\n" : "\n";
 | 
			
		||||
 | 
			
		||||
let todaysMidnight!: Date;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,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: isWindows() ? "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 },
 | 
			
		||||
 
 | 
			
		||||
@@ -321,11 +321,9 @@ export function getResourceDir() {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function isMac() {
 | 
			
		||||
    return process.platform === "darwin";
 | 
			
		||||
}
 | 
			
		||||
export const isMac = process.platform === "darwin";
 | 
			
		||||
 | 
			
		||||
export function isWindows() {
 | 
			
		||||
export const isWindows = process.platform === "win32";
 | 
			
		||||
    return process.platform === "win32";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -116,10 +116,10 @@ function getWindowExtraOpts() {
 | 
			
		||||
    const extraOpts: Partial<BrowserWindowConstructorOptions> = {};
 | 
			
		||||
 | 
			
		||||
    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 {
 | 
			
		||||
@@ -129,7 +129,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