feat: Add persistence for loaded file, scroll position, speed, and font size.

This commit is contained in:
2025-12-12 15:38:33 +01:00
parent c414258ae1
commit d70db77141
3 changed files with 123 additions and 4 deletions
+22
View File
@@ -62,3 +62,25 @@ ipcMain.handle('read-file', async (event, filePath: string) => {
throw err;
}
});
const configPath = path.join(app.getPath('userData'), 'config.json');
ipcMain.handle('load-settings', async () => {
try {
if (fs.existsSync(configPath)) {
const data = fs.readFileSync(configPath, 'utf-8');
return JSON.parse(data);
}
} catch (error) {
console.error('Failed to load settings:', error);
}
return {};
});
ipcMain.handle('save-settings', async (event, settings) => {
try {
fs.writeFileSync(configPath, JSON.stringify(settings, null, 2));
} catch (error) {
console.error('Failed to save settings:', error);
}
});