mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-19 18:45:15 +02:00
Add native screen region capture modules and preload build
This commit is contained in:
parent
6c178a0271
commit
7097f542fb
4 changed files with 309 additions and 0 deletions
21
surfsense_desktop/src/modules/general-assist.ts
Normal file
21
surfsense_desktop/src/modules/general-assist.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
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 runGeneralAssistShortcut(): Promise<void> {
|
||||
console.log('[general-assist] Shortcut triggered');
|
||||
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_screen_region_to_chat', {});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue