'use strict';
const app = require('electron').app;
const fs = require('fs');
const path = require('path');
const configFile = path.join(app.getPath('userData'), 'config.json');

function readConfigFile() {
  try {
    return JSON.parse(fs.readFileSync(configFile));
  } catch (err) {
    return {};
  }
}

module.exports = {
  set: (key, value) => {
    const config = readConfigFile();
    config[key] = value;
    fs.writeFileSync(configFile, JSON.stringify(config));
  },
  get: key => readConfigFile()[key]
};

@@ -11,17 +11,21 @@
 t';%0A
+%0A
 const 
-app
+Config
  = r
@@ -44,475 +44,139 @@
 tron
-').app;%0Aconst fs = require('fs');%0Aconst path = require('path');%0Aconst configFile = path.join(app.getPath('userData'), 'config.json');%0A%0Afunction readConfigFile() %7B%0A  try %7B%0A    return JSON.parse(fs.readFileSync(configFile));%0A  %7D catch (err) %7B%0A    return %7B%7D;%0A  %7D%0A%7D%0A%0Amodule.exports = %7B%0A  set: (key, value) =%3E %7B%0A    const config = readConfigFile();%0A    config%5Bkey%5D = value;%0A    fs.writeFileSync(configFile, JSON.stringify(config));%0A  %7D,%0A  get: key =%3E readConfigFile()%5Bkey%5D
+-config');%0A%0Amodule.exports = new Config(%7B%0A  defaults: %7B%0A    darkMode: false,%0A    closeToTray: false,%0A    minimizeToTray: false%0A  %7D
 %0A%7D
+)
 ;%0A

use electron-config