mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-10 16:22:38 +02:00
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:
parent
8b542ca3dd
commit
9cd4daa6b3
7 changed files with 396 additions and 65 deletions
|
|
@ -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', {});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue