diff --git a/surfsense_desktop/src/ipc/channels.ts b/surfsense_desktop/src/ipc/channels.ts index e41355eaf..d0e2b9ab4 100644 --- a/surfsense_desktop/src/ipc/channels.ts +++ b/surfsense_desktop/src/ipc/channels.ts @@ -15,7 +15,6 @@ export const IPC_CHANNELS = { AUTOCOMPLETE_CONTEXT: 'autocomplete-context', ACCEPT_SUGGESTION: 'accept-suggestion', DISMISS_SUGGESTION: 'dismiss-suggestion', - UPDATE_SUGGESTION_TEXT: 'update-suggestion-text', SET_AUTOCOMPLETE_ENABLED: 'set-autocomplete-enabled', GET_AUTOCOMPLETE_ENABLED: 'get-autocomplete-enabled', } as const; diff --git a/surfsense_desktop/src/modules/autocomplete/index.ts b/surfsense_desktop/src/modules/autocomplete/index.ts index 958886b63..3ed9c4a00 100644 --- a/surfsense_desktop/src/modules/autocomplete/index.ts +++ b/surfsense_desktop/src/modules/autocomplete/index.ts @@ -11,7 +11,6 @@ const SHORTCUT = 'CommandOrControl+Shift+Space'; let autocompleteEnabled = true; let savedClipboard = ''; let sourceApp = ''; -let pendingSuggestionText = ''; function isSurfSenseWindow(): boolean { const app = getFrontmostApp(); @@ -72,7 +71,6 @@ async function acceptAndInject(text: string): Promise { clipboard.writeText(text); destroySuggestion(); - pendingSuggestionText = ''; try { await new Promise((r) => setTimeout(r, 50)); @@ -90,10 +88,6 @@ function registerIpcHandlers(): void { }); ipcMain.handle(IPC_CHANNELS.DISMISS_SUGGESTION, () => { destroySuggestion(); - pendingSuggestionText = ''; - }); - ipcMain.handle(IPC_CHANNELS.UPDATE_SUGGESTION_TEXT, (_event, text: string) => { - pendingSuggestionText = text; }); ipcMain.handle(IPC_CHANNELS.SET_AUTOCOMPLETE_ENABLED, (_event, enabled: boolean) => { autocompleteEnabled = enabled; @@ -111,7 +105,6 @@ export function registerAutocomplete(): void { const sw = getSuggestionWindow(); if (sw && !sw.isDestroyed()) { destroySuggestion(); - pendingSuggestionText = ''; return; } triggerAutocomplete(); diff --git a/surfsense_desktop/src/modules/permissions.ts b/surfsense_desktop/src/modules/permissions.ts index a2f057795..02786113e 100644 --- a/surfsense_desktop/src/modules/permissions.ts +++ b/surfsense_desktop/src/modules/permissions.ts @@ -27,11 +27,6 @@ export function getPermissionsStatus(): PermissionsStatus { }; } -export function allPermissionsGranted(): boolean { - const status = getPermissionsStatus(); - return status.accessibility === 'authorized' && status.screenRecording === 'authorized'; -} - export function requestAccessibility(): void { if (!isMac()) return; const perms = getNodeMacPermissions(); diff --git a/surfsense_desktop/src/modules/platform.ts b/surfsense_desktop/src/modules/platform.ts index 1ab0c38fb..1e6ac74e4 100644 --- a/surfsense_desktop/src/modules/platform.ts +++ b/surfsense_desktop/src/modules/platform.ts @@ -19,14 +19,6 @@ export function getFrontmostApp(): string { return ''; } -export function simulateCopy(): void { - if (process.platform === 'darwin') { - execSync('osascript -e \'tell application "System Events" to keystroke "c" using command down\''); - } else if (process.platform === 'win32') { - execSync('powershell -command "Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SendKeys]::SendWait(\'^c\')"'); - } -} - export function simulatePaste(): void { if (process.platform === 'darwin') { execSync('osascript -e \'tell application "System Events" to keystroke "v" using command down\''); diff --git a/surfsense_desktop/src/preload.ts b/surfsense_desktop/src/preload.ts index 5c8b64f6f..31c5ca865 100644 --- a/surfsense_desktop/src/preload.ts +++ b/surfsense_desktop/src/preload.ts @@ -36,7 +36,6 @@ contextBridge.exposeInMainWorld('electronAPI', { }, acceptSuggestion: (text: string) => ipcRenderer.invoke(IPC_CHANNELS.ACCEPT_SUGGESTION, text), dismissSuggestion: () => ipcRenderer.invoke(IPC_CHANNELS.DISMISS_SUGGESTION), - updateSuggestionText: (text: string) => ipcRenderer.invoke(IPC_CHANNELS.UPDATE_SUGGESTION_TEXT, text), setAutocompleteEnabled: (enabled: boolean) => ipcRenderer.invoke(IPC_CHANNELS.SET_AUTOCOMPLETE_ENABLED, enabled), getAutocompleteEnabled: () => ipcRenderer.invoke(IPC_CHANNELS.GET_AUTOCOMPLETE_ENABLED), }); diff --git a/surfsense_web/app/desktop/suggestion/page.tsx b/surfsense_web/app/desktop/suggestion/page.tsx index 4de90e03c..b68fe450d 100644 --- a/surfsense_web/app/desktop/suggestion/page.tsx +++ b/surfsense_web/app/desktop/suggestion/page.tsx @@ -116,11 +116,7 @@ export default function SuggestionPage() { try { const parsed: SSEEvent = JSON.parse(data); if (parsed.type === "text-delta") { - setSuggestion((prev) => { - const updated = prev + parsed.delta; - window.electronAPI?.updateSuggestionText?.(updated); - return updated; - }); + setSuggestion((prev) => prev + parsed.delta); } else if (parsed.type === "error") { setError(friendlyError(parsed.errorText)); } diff --git a/surfsense_web/types/window.d.ts b/surfsense_web/types/window.d.ts index dc3a6465e..2fc550306 100644 --- a/surfsense_web/types/window.d.ts +++ b/surfsense_web/types/window.d.ts @@ -26,7 +26,6 @@ interface ElectronAPI { onAutocompleteContext: (callback: (data: { screenshot: string; searchSpaceId?: string }) => void) => () => void; acceptSuggestion: (text: string) => Promise; dismissSuggestion: () => Promise; - updateSuggestionText: (text: string) => Promise; setAutocompleteEnabled: (enabled: boolean) => Promise; getAutocompleteEnabled: () => Promise; }