diff --git a/home-preload.js b/home-preload.js index 7d0202f..aa3b2c9 100644 --- a/home-preload.js +++ b/home-preload.js @@ -10,6 +10,10 @@ contextBridge.exposeInMainWorld("home", { setCards: (cards) => ipcRenderer.invoke("home-cards-set", cards), resetCards: () => ipcRenderer.invoke("home-cards-reset"), navigate: (url) => ipcRenderer.invoke("navigate", url), + // Current default search engine — used to populate the search box + // placeholder with the actual engine name (e.g. "Search the web with + // Startpage") instead of hardcoding DuckDuckGo. + getEngines: () => ipcRenderer.invoke("search-engines"), // Main pushes an updated list here after a successful remote refresh // (only when the user has not customised locally). home.html re-renders. onCards: (cb) => ipcRenderer.on("home-cards", (_e, list) => cb(list)), diff --git a/home.html b/home.html index e4f86ea..6b7aba4 100644 --- a/home.html +++ b/home.html @@ -118,7 +118,7 @@

Theseus Navigator

A browser that follows the thread. Names that live on the Bitcoin Cash chain.

- +

Tip: type a .bch name in the address bar above to open a decentralized site.

@@ -165,8 +165,23 @@ e.preventDefault(); const q = $("q").value.trim(); if (!q) return; if (window.home && window.home.navigate) window.home.navigate(q); - else window.location.href = "https://duckduckgo.com/?q=" + encodeURIComponent(q); + // Fallback if the preload didn't bind (shouldn't happen). Startpage + // over DuckDuckGo since that's Theseus's own default engine now. + else window.location.href = "https://www.startpage.com/do/search?q=" + encodeURIComponent(q); }); + // Populate placeholder with the user's current default engine name so + // "Search the web with " reflects reality. Silently no-ops if + // the preload or IPC isn't available (dev-open of home.html in a plain + // Chromium tab). Also refreshes on onEngines events would be nice but + // main only broadcasts `engines` to chrome — home only queries at load, + // which is fine because switching engines is a settings action that + // usually implies a reload of the tab shortly after. + if (window.home && window.home.getEngines) { + window.home.getEngines().then((r) => { + const name = r && r.engines && r.engines.find((x) => x.id === r.current)?.name; + if (name) $("q").placeholder = "Search the web with " + name; + }).catch(() => {}); + } function badgeClass(b) { // Normalize badge label into a CSS class (spaces + case → dashes / lower). if (!b) return "b-default";