2025-06-08 04:38:42 +00:00
|
|
|
const { newtonFs } = require('./fs');
|
|
|
|
|
|
|
|
|
|
|
|
let config = {};
|
|
|
|
|
|
|
|
|
2025-06-20 01:03:02 +00:00
|
|
|
const loadSettings = () => {
|
2025-06-08 04:38:42 +00:00
|
|
|
config = JSON.parse(
|
|
|
|
newtonFs.getSettingsConfigData()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const getConfig = () => {
|
|
|
|
return config;
|
|
|
|
}
|
|
|
|
|
2025-06-19 05:57:55 +00:00
|
|
|
const saveConfig = (window) => {
|
|
|
|
if (!window) return;
|
|
|
|
|
|
|
|
const windowBounds = window.getBounds();
|
|
|
|
|
|
|
|
config["config"]["main_window_x"] = windowBounds.x;
|
|
|
|
config["config"]["main_window_y"] = windowBounds.y;
|
|
|
|
config["config"]["main_window_width"] = windowBounds.width;
|
|
|
|
config["config"]["main_window_height"] = windowBounds.height;
|
|
|
|
|
|
|
|
newtonFs.saveSettingsConfigData(
|
|
|
|
JSON.stringify(config, null, 4)
|
|
|
|
);
|
2025-06-08 04:38:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const getIconPath = () => {
|
|
|
|
return newtonFs.getIconPath();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
settingsManager: {
|
|
|
|
getIconPath: getIconPath,
|
2025-06-20 01:03:02 +00:00
|
|
|
loadSettings: loadSettings,
|
2025-06-08 04:38:42 +00:00
|
|
|
getConfig: getConfig,
|
|
|
|
saveConfig: saveConfig,
|
|
|
|
}
|
2025-06-19 05:57:55 +00:00
|
|
|
};
|