Skip to content

Commit 1c208c7

Browse files
committed
feat: Add a transcribing mode to the overlay visualizer with a loading animation.
1 parent 0031344 commit 1c208c7

File tree

3 files changed

+59
-8
lines changed

3 files changed

+59
-8
lines changed

application/src/main.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ function loadConfig() {
108108
};
109109

110110
console.log("MAIN: Store Path:", store.path);
111-
console.log("MAIN: Loaded Config from Store:", config);
112111
log.info("Loaded Config:", config);
113112
return config;
114113
}
@@ -408,6 +407,7 @@ function startRecording() {
408407
isRecording = true;
409408
updateTrayIcon(true);
410409
showOverlay();
410+
setOverlayMode("recording");
411411

412412
// Tell renderer to start recording
413413
mainWindow?.webContents.send("start-recording");
@@ -419,7 +419,8 @@ function stopRecording() {
419419
// console.log("⏹️ Recording stopped.");
420420
isRecording = false;
421421
updateTrayIcon(false);
422-
hideOverlay();
422+
// Do NOT hide overlay yet - switch to transcribing mode
423+
setOverlayMode("transcribing");
423424

424425
// Tell renderer to stop recording and send audio
425426
mainWindow?.webContents.send("stop-recording");
@@ -507,6 +508,12 @@ function hideOverlay() {
507508
}
508509
}
509510

511+
function setOverlayMode(mode) {
512+
if (overlayWindow && !overlayWindow.isDestroyed()) {
513+
overlayWindow.webContents.send("set-mode", mode);
514+
}
515+
}
516+
510517
// ============================================================================
511518
// TRANSCRIPTION (whisper.cpp)
512519
// ============================================================================
@@ -772,6 +779,9 @@ async function handleRecordingComplete() {
772779
});
773780
}
774781

782+
// Hide overlay after everything is done
783+
hideOverlay();
784+
775785
setTimeout(() => {
776786
mainWindow?.webContents.send("status", {
777787
message: `Ready! Press ${CONFIG.hotkey} to start`,

application/src/overlay-preload.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
/**
2-
* Preload script for the overlay visualizer window
3-
* Exposes only the audio level callback API
4-
*/
5-
61
const { contextBridge, ipcRenderer } = require("electron");
72

83
contextBridge.exposeInMainWorld("overlayApi", {
94
onAudioLevel: (callback) => {
105
ipcRenderer.on("audio-level", (event, level) => callback(level));
116
},
7+
onSetMode: (callback) => {
8+
ipcRenderer.on("set-mode", (event, mode) => callback(mode));
9+
},
1210
});

application/src/overlay-visualizer.html

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,33 @@
8989
0%, 100% { opacity: 1; transform: scale(1); }
9090
50% { opacity: 0.6; transform: scale(0.85); }
9191
}
92+
/* Loading dots */
93+
.loading-container {
94+
display: none;
95+
align-items: center;
96+
justify-content: center;
97+
gap: 6px;
98+
}
99+
100+
.dot {
101+
width: 6px;
102+
height: 6px;
103+
background: var(--text-secondary);
104+
border-radius: 50%;
105+
animation: bounce 1.4s infinite ease-in-out both;
106+
}
107+
108+
.dot:nth-child(1) { animation-delay: -0.32s; }
109+
.dot:nth-child(2) { animation-delay: -0.16s; }
110+
111+
@keyframes bounce {
112+
0%, 80%, 100% { transform: scale(0); }
113+
40% { transform: scale(1); }
114+
}
92115
</style>
93116
</head>
94117
<body>
95-
<div class="visualizer-container">
118+
<div class="visualizer-container" id="visualizer">
96119
<div class="rec-dot"></div>
97120
<div class="bar idle" id="bar1"></div>
98121
<div class="bar idle" id="bar2"></div>
@@ -101,6 +124,12 @@
101124
<div class="bar idle" id="bar5"></div>
102125
</div>
103126

127+
<div class="visualizer-container loading-container" id="loading">
128+
<div class="dot"></div>
129+
<div class="dot"></div>
130+
<div class="dot"></div>
131+
</div>
132+
104133
<script>
105134
const bars = [
106135
document.getElementById('bar1'),
@@ -109,6 +138,8 @@
109138
document.getElementById('bar4'),
110139
document.getElementById('bar5')
111140
];
141+
const visualizerEl = document.getElementById('visualizer');
142+
const loadingEl = document.getElementById('loading');
112143

113144
// Color palette matching the app
114145
const colors = {
@@ -118,6 +149,18 @@
118149
peak: '#ef4444' // recording (red)
119150
};
120151

152+
// Mode switching
153+
window.overlayApi.onSetMode((mode) => {
154+
if (mode === 'transcribing') {
155+
visualizerEl.style.display = 'none';
156+
loadingEl.style.display = 'flex';
157+
} else {
158+
// Default to recording
159+
visualizerEl.style.display = 'flex';
160+
loadingEl.style.display = 'none';
161+
}
162+
});
163+
121164
// Listen for audio levels from main process
122165
window.overlayApi.onAudioLevel((level) => {
123166
// level is 0.0 to 1.0

0 commit comments

Comments
 (0)