This commit is contained in:
Timothy Jaeryang Baek
2026-04-11 16:08:16 -06:00
parent 008cd8e6b9
commit aacf95cf76
3 changed files with 36 additions and 23 deletions
+28 -20
View File
@@ -1226,31 +1226,39 @@
showControls.set(true); showControls.set(true);
} }
// Consume one-shot desktop event (e.g. Spotlight query + attachments) // Consume one-shot desktop event (e.g. Spotlight query, call shortcut)
if ($desktopEvent) { if ($desktopEvent) {
const { query, files: eventFiles } = $desktopEvent; const event = $desktopEvent;
desktopEvent.set(null); desktopEvent.set(null);
// Attach screenshot images from desktop (e.g. Spotlight region capture) if (event.type === 'call') {
if (eventFiles?.length) { showCallOverlay.set(true);
for (const ef of eventFiles) { showControls.set(true);
files = [ } else if (event.type === 'query') {
...files, const query = event.data?.query;
{ const eventFiles = event.data?.files;
type: 'image',
url: ef.dataUrl,
name: ef.name
}
];
}
}
if (query || eventFiles?.length) { // Attach screenshot images from desktop (e.g. Spotlight region capture)
if (query) { if (eventFiles?.length) {
messageInput?.setText(query); for (const ef of eventFiles) {
files = [
...files,
{
type: 'image',
url: ef.dataUrl,
name: ef.name
}
];
}
}
if (query || eventFiles?.length) {
if (query) {
messageInput?.setText(query);
}
await tick();
submitHandler(query || '');
} }
await tick();
submitHandler(query || '');
} }
} else if ($page.url.searchParams.get('q')) { } else if ($page.url.searchParams.get('q')) {
const q = $page.url.searchParams.get('q') ?? ''; const q = $page.url.searchParams.get('q') ?? '';
+2 -2
View File
@@ -116,8 +116,8 @@ export const temporaryChatEnabled = writable(false);
// Set by +layout.svelte, consumed and cleared by Chat.svelte. // Set by +layout.svelte, consumed and cleared by Chat.svelte.
export type DesktopEventFile = { name: string; mimeType: string; dataUrl: string }; export type DesktopEventFile = { name: string; mimeType: string; dataUrl: string };
export type DesktopEvent = { export type DesktopEvent = {
query?: string; type: string;
files?: DesktopEventFile[]; data?: any;
}; };
export const desktopEvent: Writable<DesktopEvent | null> = writable(null); export const desktopEvent: Writable<DesktopEvent | null> = writable(null);
export const scrollPaginationEnabled = writable(false); export const scrollPaginationEnabled = writable(false);
+6 -1
View File
@@ -712,7 +712,12 @@
return; return;
} }
if (event.type === 'query' && (event.data?.query || event.data?.files?.length)) { if (event.type === 'query' && (event.data?.query || event.data?.files?.length)) {
desktopEvent.set({ query: event.data.query, files: event.data.files }); desktopEvent.set(event);
await goto('/');
return;
}
if (event.type === 'call') {
desktopEvent.set(event);
await goto('/'); await goto('/');
return; return;
} }