mirror of
https://github.com/open-webui/desktop.git
synced 2026-11-05 01:27:46 +00:00
[PR #280] feat(spotlight): context-aware Spotlight (selection, source app, fold… #241
Labels
No labels
help wanted
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
open-webui/desktop#241
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/desktop/pull/280
Author: @BenAndNuts
Created: 10/14/2026
Status: 🔄 Open
Base:
main← Head:feat/spotlight-context📝 Commits (1)
9a6d9a6feat(spotlight): context-aware Spotlight (selection, source app, folder, model, prompt)📊 Changes
10 files changed (+1460 additions, -52 deletions)
View changed files
📝
package-lock.json(+355 -2)📝
package.json(+1 -0)📝
src/main/index.ts(+209 -35)📝
src/main/utils/index.ts(+12 -0)➕
src/main/utils/selection.ts(+221 -0)📝
src/preload/index.ts(+2 -0)📝
src/preload/spotlight-preload.ts(+22 -2)📝
src/renderer/src/components/Spotlight.svelte(+443 -13)📝
src/renderer/src/lib/components/Main/Connections.svelte(+82 -0)📝
src/renderer/src/lib/components/Main/Settings/General.svelte(+113 -0)📄 Description
feat(spotlight): context-aware Spotlight (selection, source app, folder, model, prompt)
Description
Spotlight is great for firing a quick question from any app, but today it only takes the clipboard and always lands in a new chat with the default model, no folder and no prompt. When work is organised in folders (system prompt, knowledge, default models), in expert models and in saved prompts, you have to open the main window and set all of that up by hand.
This PR turns Spotlight into a quick launcher into the right Open WebUI context:
1. Selected text (Windows)
Pressing the shortcut captures the text selected in the foreground app, no Ctrl+C needed. The copy is simulated once the shortcut's modifier keys are released (so Alt/Shift/Win don't turn it into another shortcut) and the user's clipboard is restored (text, HTML, RTF, image). Falls back to the existing clipboard auto-paste. New setting: Capture Selected Text (on by default).
2. Source app (Windows)
The bar shows which app the text comes from, with its icon: Working with Microsoft Outlook.
3. Folder / model / prompt pickers
Three compact chips under the input, each opening a filterable, keyboard-driven list (type to filter, ↑/↓, Enter, Esc closes the list before Spotlight):
Parent / Child.{{CLIPBOARD}}with the text, or the text is appended after it. Open WebUI then resolves its other variables ({{USER_NAME}}, dates, input fields) as usual.4. Defaults
Settings → General → Spotlight Defaults: folder, model and prompt preselected each time Spotlight opens.
5. Send right away or open the chat
Enter or a click on the send button uses the mode chosen in Settings; Shift+Enter or Shift+click uses the other one (the button icon switches while Shift is held):
queryflow (unchanged). With folder/model, a new chat is opened there and the pre-filled message is submitted once it's in the input. It waits while a dialog (e.g. prompt input variables) is open, never submits a stale draft, and gives up after 20 s leaving the text in place.No server-side change. Everything reuses what Open WebUI already supports:
/folders/:id,?models=,?q=(withsubmit=false, which 0.11.x honours and 0.12 ignores) and thepage:navigatedesktop event. Tested against 0.11.4 and 0.12 code paths.Implementation
main/utils/selection.ts(new): foreground app (name from the exe's FileDescription, icon viaapp.getFileIcon) and selection capture, through Win32 via koffi (prebuilt N-API binaries, no native build step added).main/index.ts:spotlight:getContextIPC (/api/models,/api/v1/folders/,/api/v1/prompts/, 5 s timeout,allSettled);spotlight:submittakes{ folderId, modelId, mode }; init payload carries source app, defaults and mode; sharedgetAuthToken()helper (voice input now uses it too, same behaviour).Main/Connections.svelte: relays anavigatemessage to the webview and, in send mode, submits once the text is there.components/Spotlight.svelte: source-app header, chips, picker panel, mode hint (light/dark).Settings/General.svelte: Capture Selected Text (Windows) and Spotlight Defaults.spotlightCaptureSelection,spotlightDefaultFolderId,spotlightDefaultModelId,spotlightDefaultPromptId,spotlightSubmitMode(defaultsend, i.e. today's behaviour).Known limitations
Checks:
svelte-check0 errors,tsc(node) clean,electron-vite buildOK, no new ESLint errors in touched files. Spotlight UI tested in light/dark with a mocked API; the auto-submit script tested against a mock page (submits once the text is set, waits while a dialog is open, ignores a stale draft); manual test on Windows 11 against an Open WebUI server.Related Issues
Contributor License Agreement
🤖 Generated with Claude Code
https://claude.ai/code/session_01ShBh89bRFKdYGWJGZE6WjF
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.