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);
}
// Consume one-shot desktop event (e.g. Spotlight query + attachments)
// Consume one-shot desktop event (e.g. Spotlight query, call shortcut)
if ($desktopEvent) {
const { query, files: eventFiles } = $desktopEvent;
const event = $desktopEvent;
desktopEvent.set(null);
// Attach screenshot images from desktop (e.g. Spotlight region capture)
if (eventFiles?.length) {
for (const ef of eventFiles) {
files = [
...files,
{
type: 'image',
url: ef.dataUrl,
name: ef.name
}
];
}
}
if (event.type === 'call') {
showCallOverlay.set(true);
showControls.set(true);
} else if (event.type === 'query') {
const query = event.data?.query;
const eventFiles = event.data?.files;
if (query || eventFiles?.length) {
if (query) {
messageInput?.setText(query);
// Attach screenshot images from desktop (e.g. Spotlight region capture)
if (eventFiles?.length) {
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')) {
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.
export type DesktopEventFile = { name: string; mimeType: string; dataUrl: string };
export type DesktopEvent = {
query?: string;
files?: DesktopEventFile[];
type: string;
data?: any;
};
export const desktopEvent: Writable<DesktopEvent | null> = writable(null);
export const scrollPaginationEnabled = writable(false);
+6 -1
View File
@@ -712,7 +712,12 @@
return;
}
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('/');
return;
}