heynote/electron/config.js
Florian Labarre 0f3c714d56
CloseBrackets setting toggle (#102)
* Add a setting to toggle the auto bracket-closing of CodeMirror

* Move Auto-close brackets setting into new settings tab Editing

* Add tests for Auto-close bracket setting

---------

Co-authored-by: Jonatan Heyman <jonatan@heyman.info>
2024-01-04 14:52:41 +01:00

69 lines
2.1 KiB
JavaScript

import Store from "electron-store"
const isDev = !!process.env.VITE_DEV_SERVER_URL
const schema = {
additionalProperties: false,
windowConfig: {
type: "object",
properties: {
width: {type: "number"},
height: {type: "number"},
x: {type: "number"},
y: {type: "number"},
isMaximized: {type: "boolean"},
isFullScreen: {type: "boolean"},
},
additionalProperties: false,
},
settings: {
type: "object",
properties: {
"keymap": { "enum": ["default", "emacs"], default:"default" },
"emacsMetaKey": { "enum": [null, "alt", "meta"], default: null },
"showLineNumberGutter": {type: "boolean", default:true},
"showFoldGutter": {type: "boolean", default:true},
"autoUpdate": {type: "boolean", default: true},
"allowBetaVersions": {type: "boolean", default: false},
"enableGlobalHotkey": {type: "boolean", default: false},
"globalHotkey": {type: "string", default: "CmdOrCtrl+Shift+H"},
"bufferPath" : {type: "string", default: ""},
"showInDock": {type: "boolean", default: true},
"showInMenu": {type: "boolean", default: false},
"bracketClosing": {type: "boolean", default: false},
},
},
theme: {type: "string", default: "system"},
currency: {
type: "object",
properties: {
data: {type: "object"},
timeFetched: {type: "number"},
},
},
}
const defaults = {
settings: {
keymap: "default",
emacsMetaKey: "meta",
showLineNumberGutter: true,
showFoldGutter: true,
autoUpdate: true,
allowBetaVersions: false,
enableGlobalHotkey: false,
globalHotkey: "CmdOrCtrl+Shift+H",
bufferPath: "",
showInDock: true,
showInMenu: false,
bracketClosing: false,
},
theme: "system",
}
export default new Store({schema, defaults, name: isDev ? "config-dev" : "config"})