mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-05 22:02:39 +02:00
Add Screenshot Assist shortcut flow: show window, pick region, send data URL to chat.
This commit is contained in:
parent
d212422bf5
commit
7145a15149
1 changed files with 20 additions and 0 deletions
20
surfsense_desktop/src/modules/screenshot-assist.ts
Normal file
20
surfsense_desktop/src/modules/screenshot-assist.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { IPC_CHANNELS } from '../ipc/channels';
|
||||
import { trackEvent } from './analytics';
|
||||
import { pickScreenRegion } from './screen-region-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 mw = getMainWindow();
|
||||
if (url && 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