feat(config): 添加GPU加速设置支持

This commit is contained in:
algerkong
2025-09-20 16:51:47 +08:00
parent 67370b9072
commit c83ad48ef4
8 changed files with 142 additions and 11 deletions
+18
View File
@@ -25,6 +25,7 @@ type SetConfig = {
fontScope: 'global' | 'lyric';
language: string;
showTopAction: boolean;
enableGpuAcceleration: boolean;
};
interface StoreType {
set: SetConfig;
@@ -57,6 +58,23 @@ export function initializeConfig() {
_.returnValue = value || '';
});
// GPU加速设置更新处理
// 注意:GPU加速设置必须在应用启动时在app.ready之前设置才能生效
ipcMain.on('update-gpu-acceleration', (event, enabled: boolean) => {
try {
console.log('GPU加速设置更新:', enabled);
store.set('set.enableGpuAcceleration', enabled);
// GPU加速设置需要重启应用才能生效
event.sender.send('gpu-acceleration-updated', enabled);
console.log('GPU加速设置已保存,重启应用后生效');
} catch (error) {
console.error('GPU加速设置更新失败:', error);
const errorMessage = error instanceof Error ? error.message : String(error);
event.sender.send('gpu-acceleration-update-error', errorMessage);
}
});
return store;
}