Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

sizing changes

Gabriel Stein8a0a1527999c
diff --git a/index.html b/index.html
index f1f548808..d23da9213 100644
--- a/index.html
+++ b/index.html
@@ -72,6 +72,37 @@
</div>
);
+ // Voice bar animation component (smaller bars)
+ const VoiceBar = ({ active }) => {
+ const [tick, setTick] = React.useState(0);
+ React.useEffect(() => {
+ if (!active) return;
+ const interval = setInterval(() => setTick(t => t + 1), 40);
+ return () => clearInterval(interval);
+ }, [active]);
+ return (
+ <div style={{ display: 'flex', alignItems: 'flex-end', height: 10, gap: 1 }}>
+ {[...Array(10)].map((_, i) => {
+ const phase = (tick + i * 2) / 4;
+ const height = active ? (4 + 4 * (0.5 + 0.5 * Math.sin(phase))) : 4;
+ return (
+ <div
+ key={i}
+ style={{
+ width: 2,
+ height,
+ background: 'white',
+ borderRadius: 1,
+ transition: 'height 0.15s',
+ opacity: 0.95
+ }}
+ />
+ );
+ })}
+ </div>
+ );
+ };
+
// Main App Component
const App = () => {
const [isRecording, setIsRecording] = useState(false);
@@ -175,86 +206,64 @@
ipcRenderer.invoke('hide-window');
};
+ useEffect(() => {
+ let recording = false;
+ const handleToggle = () => {
+ if (!recording && !isRecording && !isProcessing) {
+ startRecording();
+ recording = true;
+ } else if (isRecording) {
+ stopRecording();
+ recording = false;
+ }
+ };
+ ipcRenderer.on('toggle-dictation', handleToggle);
+ return () => {
+ ipcRenderer.removeListener('toggle-dictation', handleToggle);
+ };
+ }, [isRecording, isProcessing]);
+
+ // Remove spacebar logic for recording
const handleKeyPress = (e) => {
if (e.key === 'Escape') {
handleClose();
- } else if (e.key === ' ' && !isRecording && !isProcessing) {
- e.preventDefault();
- startRecording();
- } else if (e.key === ' ' && isRecording) {
- e.preventDefault();
- stopRecording();
}
};
-
useEffect(() => {
document.addEventListener('keydown', handleKeyPress);
return () => document.removeEventListener('keydown', handleKeyPress);
- }, [isRecording, isProcessing]);
+ }, []);
+ // Minimal always-visible tab UI (no bars when idle)
return (
- <div className="p-4">
- <Card className="glass-effect border-white/20 bg-white/10 backdrop-blur-xl">
- <CardContent className="p-6">
- <div className="flex flex-col items-center space-y-4">
- <div className="flex items-center justify-between w-full">
- <h2 className="text-lg font-semibold text-white">Whisper Dictation</h2>
- <Button
- variant="ghost"
- size="sm"
- onClick={handleClose}
- className="text-white hover:bg-white/20"
- >
- ✕
- </Button>
- </div>
-
- <div className="flex flex-col items-center space-y-3">
- {isProcessing ? (
- <div className="flex flex-col items-center space-y-2">
- <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-white"></div>
- <p className="text-sm text-white/80">Processing...</p>
- </div>
- ) : (
- <Button
- onClick={isRecording ? stopRecording : startRecording}
- className={`w-16 h-16 rounded-full ${
- isRecording
- ? 'bg-red-500 hover:bg-red-600 animate-pulse'
- : 'bg-blue-500 hover:bg-blue-600'
- }`}
- disabled={isProcessing}
- >
- {isRecording ? '⏹️' : '🎤'}
- </Button>
- )}
-
- <p className="text-xs text-white/70 text-center">
- {isRecording
- ? 'Recording... Press space or click to stop'
- : 'Press space or click to start recording'
- }
- </p>
- </div>
-
- {transcript && (
- <div className="w-full p-3 bg-white/20 rounded-md">
- <p className="text-sm text-white">{transcript}</p>
- </div>
- )}
-
- {error && (
- <div className="w-full p-3 bg-red-500/20 rounded-md">
- <p className="text-sm text-red-200">{error}</p>
- </div>
- )}
-
- <p className="text-xs text-white/50 text-center">
- Press Fn key or Cmd+` to toggle • ESC to close
- </p>
- </div>
- </CardContent>
- </Card>
+ <div style={{
+ width: '100%',
+ height: '100%',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ pointerEvents: 'none',
+ }}>
+ <div
+ className="glass-effect"
+ style={{
+ minWidth: 40,
+ minHeight: 8,
+ maxWidth: 40,
+ maxHeight: 8,
+ background: 'rgba(30,30,30,0.85)',
+ border: '1px solid #ccc',
+ borderRadius: 10,
+ boxShadow: '0 1px 6px rgba(0,0,0,0.10)',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ padding: '1px 6px',
+ pointerEvents: 'auto',
+ }}
+ >
+ {(isRecording || isProcessing) ? <VoiceBar active={true} /> : null}
+ </div>
</div>
);
};
diff --git a/main.js b/main.js
index 03c6ee345..81be8e938 100644
--- a/main.js
+++ b/main.js
@@ -1,4 +1,4 @@
-const { app, BrowserWindow, globalShortcut, ipcMain, clipboard, shell } = require("electron")
+const { app, BrowserWindow, globalShortcut, ipcMain, clipboard, shell, screen } = require("electron")
const path = require("path")
const { spawn } = require("child_process")
require('dotenv').config() // Load .env
@@ -6,12 +6,18 @@ require('dotenv').config() // Load .env
let mainWindow
function createWindow() {
- // Check if we're in development mode
- const isDev = process.argv.includes('--dev') || process.env.NODE_ENV === 'development'
-
+ // Always show window by default
+ const display = screen.getPrimaryDisplay();
+ const width = 80;
+ const height = 20;
+ const x = display.bounds.x + Math.round((display.workArea.width - width) / 2);
+ const y = display.bounds.y + display.workArea.height; // 2px margin from bottom
+
mainWindow = new BrowserWindow({
- width: 400,
- height: 300,
+ width,
+ height,
+ x,
+ y,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
@@ -22,8 +28,9 @@ function createWindow() {
resizable: false,
skipTaskbar: true,
transparent: true,
- show: isDev, // Show window by default in development mode
+ show: true, // Always show
})
+
mainWindow.loadFile("index.html")
@@ -35,38 +42,31 @@ function createWindow() {
`);
});
- // Register global shortcut for activation - using F13 (Fn key on Mac)
- globalShortcut.register("F13", () => {
- console.log("Global shortcut activated!")
- if (mainWindow.isVisible()) {
- mainWindow.hide()
- console.log("Window hidden")
- } else {
- mainWindow.show()
- mainWindow.focus()
- console.log("Window shown")
- }
- })
+ // Remove all previous shortcuts
+ globalShortcut.unregisterAll();
- // Alternative: Use Cmd+` (backtick) which is easier to reach
- globalShortcut.register("CommandOrControl+`", () => {
- console.log("Alternative shortcut activated!")
- if (mainWindow.isVisible()) {
- mainWindow.hide()
- } else {
- mainWindow.show()
- mainWindow.focus()
+ // Register global shortcut for backtick (`) key to toggle dictation
+ globalShortcut.register('`', () => {
+ if (!mainWindow.isVisible()) {
+ mainWindow.show();
}
- })
+ mainWindow.webContents.send('toggle-dictation');
+ });
+
+ // Ensure window is always on top, even above fullscreen apps
+ mainWindow.setAlwaysOnTop(true, 'screen-saver');
+ mainWindow.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true });
+ mainWindow.on('show', () => {
+ mainWindow.setAlwaysOnTop(true, 'screen-saver');
+ mainWindow.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true });
+ });
}
app.whenReady().then(() => {
createWindow()
console.log("🎤 Open Scribe started!")
console.log("📋 Shortcuts:")
- console.log(" - Fn key (F13) to toggle window")
- console.log(" - Cmd+` (backtick) to toggle window")
- console.log(" - Space to start/stop recording")
+ console.log(" - Press ` (backtick) to start/stop dictation and auto-paste")
console.log(" - ESC to close window")
})
@@ -89,11 +89,6 @@ app.on("will-quit", () => {
// IPC handlers
ipcMain.handle("paste-text", async (event, text) => {
console.log("Pasting text:", text)
- // Hide the window first
- mainWindow.hide()
-
- // Wait a bit for the window to hide
- await new Promise((resolve) => setTimeout(resolve, 100))
// Copy text to clipboard and simulate paste
clipboard.writeText(text)