Add a single-session desktop window picker and route screenshot assist, region crop, and fullscreen capture through the cached frame.

This commit is contained in:
CREDO23 2026-04-27 20:35:47 +02:00
parent 8b542ca3dd
commit 9cd4daa6b3
7 changed files with 396 additions and 65 deletions

View file

@ -1,19 +1,25 @@
import { IPC_CHANNELS } from '../ipc/channels';
import { trackEvent } from './analytics';
import { pickScreenRegion } from './screen-region-picker';
import { pickOpenWindowCapture } from './window-picker';
import { getMainWindow, showMainWindow } from './window';
import { hasScreenRecordingPermission, requestScreenRecording } from './permissions';
export async function runScreenshotAssistShortcut(): Promise<void> {
showMainWindow('shortcut');
await new Promise((r) => setTimeout(r, 400));
if (!hasScreenRecordingPermission()) {
requestScreenRecording();
return;
}
const url = await pickScreenRegion();
const picked = await pickOpenWindowCapture();
if (!picked) return;
const url = await pickScreenRegion({ windowDataUrl: picked.dataUrl });
if (!url) return;
showMainWindow('shortcut');
const mw = getMainWindow();
if (url && mw && !mw.isDestroyed()) {
if (mw && !mw.isDestroyed()) {
mw.webContents.send(IPC_CHANNELS.CHAT_SCREEN_CAPTURE, url);
trackEvent('desktop_screenshot_assist_region_to_chat', {});
}