Skip to content

Commit 4b7f594

Browse files
Bortlesboatclaude
andcommitted
fix: display app version in More menu
Add IPC handler to expose app.getVersion() to the renderer and display it in the More dropdown menu. Users can now verify which version they're running. Fixes #70 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6e69da0 commit 4b7f594

4 files changed

Lines changed: 38 additions & 0 deletions

File tree

electron/electron-env.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ interface Window {
286286
message?: string;
287287
error?: string;
288288
}>;
289+
/** Returns the app version from package.json */
290+
getAppVersion: () => Promise<string>;
289291
/** Hide the OS cursor before browser capture starts. */
290292
hideOsCursor: () => Promise<{ success: boolean }>;
291293
/** Countdown timer before recording */

electron/ipc/handlers.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4474,5 +4474,9 @@ body{background:transparent;overflow:hidden;width:100vw;height:100vh}
44744474
seconds: countdownInProgress ? countdownRemaining : null,
44754475
}
44764476
})
4477+
4478+
ipcMain.handle('app:getVersion', () => {
4479+
return app.getVersion()
4480+
})
44774481
}
44784482

electron/preload.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ contextBridge.exposeInMainWorld("electronAPI", {
296296
isNativeWindowsCaptureAvailable: () => ipcRenderer.invoke("is-native-windows-capture-available"),
297297
muxNativeWindowsRecording: () => ipcRenderer.invoke("mux-native-windows-recording"),
298298
hideOsCursor: () => ipcRenderer.invoke("hide-cursor"),
299+
getAppVersion: () => ipcRenderer.invoke("app:getVersion"),
299300
getCountdownDelay: () => ipcRenderer.invoke("get-countdown-delay"),
300301
setCountdownDelay: (delay: number) => ipcRenderer.invoke("set-countdown-delay", delay),
301302
startCountdown: (seconds: number) => ipcRenderer.invoke("start-countdown", seconds),

src/components/launch/LaunchWindow.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ export function LaunchWindow() {
188188
const [sourcesLoading, setSourcesLoading] = useState(false);
189189
const [hideHudFromCapture, setHideHudFromCapture] = useState(true);
190190
const [platform, setPlatform] = useState<string | null>(null);
191+
const [appVersion, setAppVersion] = useState<string | null>(null);
191192
const dropdownRef = useRef<HTMLDivElement>(null);
192193
const hudContentRef = useRef<HTMLDivElement>(null);
193194
const hudBarRef = useRef<HTMLDivElement>(null);
@@ -372,6 +373,22 @@ export function LaunchWindow() {
372373
};
373374
}, []);
374375

376+
useEffect(() => {
377+
let cancelled = false;
378+
const loadVersion = async () => {
379+
try {
380+
const version = await window.electronAPI.getAppVersion();
381+
if (!cancelled) setAppVersion(version);
382+
} catch (error) {
383+
console.error("Failed to load app version:", error);
384+
}
385+
};
386+
void loadVersion();
387+
return () => {
388+
cancelled = true;
389+
};
390+
}, []);
391+
375392
useEffect(() => {
376393
let cancelled = false;
377394
const loadHudCaptureProtection = async () => {
@@ -1006,6 +1023,20 @@ export function LaunchWindow() {
10061023
{LOCALE_LABELS[code] ?? code}
10071024
</DropdownItem>
10081025
))}
1026+
{appVersion && (
1027+
<div
1028+
style={{
1029+
marginTop: 8,
1030+
padding: "4px 12px",
1031+
fontSize: 11,
1032+
color: "#6b6b78",
1033+
textAlign: "center",
1034+
userSelect: "text",
1035+
}}
1036+
>
1037+
v{appVersion}
1038+
</div>
1039+
)}
10091040
</>
10101041
)}
10111042
</div>

0 commit comments

Comments
 (0)