Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Feature/set press and hold on macOS #2331

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
14 changes: 13 additions & 1 deletion main/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as minimist from "minimist"
import * as path from "path"

import { app, BrowserWindow, ipcMain, Menu } from "electron"
import { app, BrowserWindow, ipcMain, Menu, systemPreferences } from "electron"

import * as PersistentSettings from "electron-settings"

Expand Down Expand Up @@ -130,6 +130,18 @@ if (!isDevelopment && !isDebug && !isAutomation) {
if (!isAutomation) {
await addDevExtensions()
}

if (process.platform.includes("darwin")) {
const pressAndHold = systemPreferences.getUserDefault(
"ApplePressAndHoldEnabled",
"boolean",
)

if (pressAndHold) {
const untypedPrefs = systemPreferences as any
untypedPrefs.setUserDefault("ApplePressAndHoldEnabled", "boolean", false)
}
}
loadFileFromArguments(process.platform, argsToUse, process.env.ONI_CWD || process.cwd())
})
}
Expand Down