Skip to content

Commit 01cd0ad

Browse files
committed
Fix blank UI on Windows; add ML env option to uninstaller
Blank UI on Windows: - Call app.disableHardwareAcceleration() on win32 before app.whenReady() to prevent blank-screen issue caused by certain GPU drivers (very common Electron/Windows bug) - Use show:false + ready-to-show event so the window appears only after content is rendered, eliminating the blank flash on slow machines - Add F12 / Ctrl+Shift+I shortcut to open DevTools for in-field debugging - Wrap init() with .catch() so any startup error shows a readable message instead of a silent blank screen Uninstaller improvements: - Add "Keep ML environment" checkbox (was always deleted before) - All three items (venv, content, settings) are now opt-in to delete, defaulting to Keep so no accidental data loss - Update preload.js runUninstall() and main.js handler to accept keepVenv - Update size display copy to reflect the new opt-in model
1 parent 4ecfb1e commit 01cd0ad

4 files changed

Lines changed: 45 additions & 12 deletions

File tree

electron/main.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -719,11 +719,13 @@ function registerIpc() {
719719
};
720720
});
721721

722-
ipcMain.handle('uninstall:run', async (_, { keepContent, keepSettings }) => {
722+
ipcMain.handle('uninstall:run', async (_, { keepContent, keepSettings, keepVenv }) => {
723723
try {
724-
// 1. Always delete ML venv (large, no user value without the app)
725-
const venvDir = path.join(DATA_DIR, 'venv');
726-
if (fs.existsSync(venvDir)) rmRecursive(venvDir);
724+
// 1. Optionally delete ML venv
725+
if (!keepVenv) {
726+
const venvDir = path.join(DATA_DIR, 'venv');
727+
if (fs.existsSync(venvDir)) rmRecursive(venvDir);
728+
}
727729

728730
// 2. Optionally delete generated content (OUTPUT_DIR if separate from DATA_DIR)
729731
if (!keepContent) {
@@ -772,18 +774,32 @@ function createWindow() {
772774
height: 780,
773775
minWidth: 720,
774776
minHeight: 520,
777+
show: false, // wait for ready-to-show to avoid blank flash
775778
backgroundColor: '#1E2A2A',
776779
webPreferences: {
777780
preload: path.join(__dirname, 'preload.js'),
778781
nodeIntegration: false,
779782
contextIsolation: true,
780783
},
781784
});
785+
mainWindow.once('ready-to-show', () => mainWindow.show());
782786
mainWindow.loadFile(path.join(__dirname, 'renderer', 'index.html'));
783787
if (process.env.AUTONOTE_DEV) mainWindow.webContents.openDevTools();
788+
// F12 / Ctrl+Shift+I opens DevTools for in-field debugging
789+
mainWindow.webContents.on('before-input-event', (_, input) => {
790+
if (input.type !== 'keyDown') return;
791+
if (input.key === 'F12' ||
792+
(input.control && input.shift && input.key === 'I')) {
793+
mainWindow.webContents.openDevTools();
794+
}
795+
});
784796
mainWindow.on('closed', () => { mainWindow = null; });
785797
}
786798

799+
// Disable GPU hardware acceleration on Windows to prevent blank white/teal
800+
// screen that can occur with certain GPU drivers (very common Electron issue).
801+
if (process.platform === 'win32') app.disableHardwareAcceleration();
802+
787803
app.whenReady().then(() => {
788804
registerIpc();
789805
createWindow();

electron/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "auto-note",
3-
"version": "0.9.0",
3+
"version": "0.9.2",
44
"description": "AutoNote — lecture notes generator from Canvas recordings",
55
"main": "main.js",
66
"scripts": {

electron/preload.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,5 @@ contextBridge.exposeInMainWorld('api', {
5858

5959
// ── Uninstaller ───────────────────────────────────────────────────────────
6060
getUninstallSizes: () => ipcRenderer.invoke('uninstall:sizes'),
61-
runUninstall: (keepContent, keepSettings) => ipcRenderer.invoke('uninstall:run', { keepContent, keepSettings }),
61+
runUninstall: (keepContent, keepSettings, keepVenv) => ipcRenderer.invoke('uninstall:run', { keepContent, keepSettings, keepVenv }),
6262
});

electron/renderer/app.js

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -728,12 +728,16 @@ function buildUninstallSection() {
728728
<div style="margin-top:24px;padding:16px;border:1px solid var(--c-red,#e53935);border-radius:8px;background:rgba(229,57,53,0.06)">
729729
<div style="font-weight:600;font-size:14px;color:var(--c-red,#e53935);margin-bottom:6px">Danger Zone — Uninstall AutoNote</div>
730730
<div style="font-size:12px;color:var(--c-white-60);margin-bottom:12px">
731-
The ML environment will always be removed. Choose what else to keep.
731+
Choose what to remove. Unchecked items will be permanently deleted.
732732
</div>
733733
<div id="uninstall-sizes" style="font-size:12px;color:var(--c-white-60);margin-bottom:12px;line-height:1.8">
734734
Calculating sizes…
735735
</div>
736736
<div style="display:flex;flex-direction:column;gap:8px;margin-bottom:14px">
737+
<label style="display:flex;align-items:center;gap:8px;font-size:13px;cursor:pointer">
738+
<input type="checkbox" id="uninstall-keep-venv" checked>
739+
Keep ML environment (PyTorch, Whisper, sentence-transformers, …)
740+
</label>
737741
<label style="display:flex;align-items:center;gap:8px;font-size:13px;cursor:pointer">
738742
<input type="checkbox" id="uninstall-keep-content" checked>
739743
Keep generated content (notes, captions, alignment, videos, materials)
@@ -1301,9 +1305,8 @@ async function attachPageHandlers() {
13011305
try {
13021306
const s = await window.api.getUninstallSizes();
13031307
const fmt = mb => mb >= 1024 ? `${(mb/1024).toFixed(1)} GB` : `${mb} MB`;
1304-
let html = `<b>Always deleted:</b><br>`;
1308+
let html = `<b>Disk usage (controlled by checkboxes below):</b><br>`;
13051309
html += `&nbsp;&nbsp;• ML Environment (~/.auto_note/venv): <b>${fmt(s.venv)}</b><br>`;
1306-
html += `<br><b>Optional (controlled by checkboxes below):</b><br>`;
13071310
html += `&nbsp;&nbsp;• Settings &amp; config (~/.auto_note/): <b>${fmt(s.settings)}</b><br>`;
13081311
if (s.content !== null) {
13091312
html += `&nbsp;&nbsp;• Generated content (${s.outputDir}): <b>${fmt(s.content)}</b>`;
@@ -1316,11 +1319,14 @@ async function attachPageHandlers() {
13161319

13171320
// Uninstall button
13181321
document.getElementById('btn-uninstall')?.addEventListener('click', async () => {
1322+
const keepVenv = document.getElementById('uninstall-keep-venv')?.checked ?? true;
13191323
const keepContent = document.getElementById('uninstall-keep-content')?.checked ?? true;
13201324
const keepSettings = document.getElementById('uninstall-keep-settings')?.checked ?? true;
1321-
const lines = ['This will permanently delete:', ' • ML environment (~/.auto_note/venv)'];
1325+
const lines = ['This will permanently delete:'];
1326+
if (!keepVenv) lines.push(' • ML environment (~/.auto_note/venv)');
13221327
if (!keepSettings) lines.push(' • All settings, API keys, and credentials');
13231328
if (!keepContent) lines.push(' • All generated content (notes, captions, videos…)');
1329+
if (lines.length === 1) lines.push(' (nothing — all items are set to Keep)');
13241330
lines.push('', 'This cannot be undone. Continue?');
13251331

13261332
if (!confirm(lines.join('\n'))) return;
@@ -1329,7 +1335,7 @@ async function attachPageHandlers() {
13291335
btn.disabled = true;
13301336
btn.textContent = 'Uninstalling…';
13311337

1332-
const result = await window.api.runUninstall(keepContent, keepSettings);
1338+
const result = await window.api.runUninstall(keepContent, keepSettings, keepVenv);
13331339
if (result.ok) {
13341340
const isWin = result.platform === 'win32';
13351341
alert(
@@ -1435,4 +1441,15 @@ async function init() {
14351441
renderPage();
14361442
}
14371443

1438-
init();
1444+
init().catch(err => {
1445+
// If init() throws (e.g. IPC timeout or JS error), show a visible error
1446+
// instead of a silent blank screen.
1447+
document.body.innerHTML =
1448+
`<div style="padding:40px;font-family:monospace;color:#EF5350;background:#1E2A2A;height:100vh">
1449+
<h2 style="margin-bottom:16px">AutoNote failed to start</h2>
1450+
<pre style="white-space:pre-wrap;font-size:12px">${String(err?.stack || err)}</pre>
1451+
<p style="margin-top:16px;color:#aaa;font-size:12px">
1452+
Press F12 to open DevTools for more details, then reload (Ctrl+R).
1453+
</p>
1454+
</div>`;
1455+
});

0 commit comments

Comments
 (0)