Address-picker fix:
Picking a suggestion from the address dropdown loaded the URL but
left the address bar showing the 3-4 letters the user had typed.
Root cause: onTabs's focus guard
if (document.activeElement !== $("url")) $("url").value = d.url
skipped its write while the URL input still held DOM focus, and
clicking a sibling WebContentsView doesn't always deliver the blur
to the chrome renderer in time. Fix: address-pick sends an explicit
address-picked IPC to the chrome, which force-blurs and writes the
full picked URL before the tabs event arrives.
Reload keys:
None of the standard reload accelerators worked (Menu.setApplicationMenu(null)
drops Chromium's default menu accelerators, and hard-reload was never
wired at any layer). Now:
F5 / Ctrl+R -> soft reload
Ctrl+F5 / Ctrl+Shift+R -> hard reload (reloadIgnoringCache)
Shift-click on the toolbar reload button -> hard reload
Same before-input-event hook that carries Ctrl+Shift+M; always targets
the active tab regardless of which view got the key, and skips the
Settings tab. Toolbar tooltip updated to advertise Shift-click.
53 lines
3.3 KiB
JavaScript
53 lines
3.3 KiB
JavaScript
const { contextBridge, ipcRenderer } = require("electron");
|
|
contextBridge.exposeInMainWorld("theseus", {
|
|
navigate: (input) => ipcRenderer.invoke("navigate", input),
|
|
search: (q) => ipcRenderer.invoke("search", q),
|
|
newTab: () => ipcRenderer.invoke("new-tab"),
|
|
closeTab: (id) => ipcRenderer.invoke("close-tab", id),
|
|
switchTab: (id) => ipcRenderer.invoke("switch-tab", id),
|
|
moveTab: (id, targetId, place) => ipcRenderer.invoke("move-tab", id, targetId, place),
|
|
suggestAddress: (query, rect) => ipcRenderer.invoke("suggest-address", query, rect),
|
|
closeAddressPicker: () => ipcRenderer.invoke("close-address-picker"),
|
|
addressCursor: (dir) => ipcRenderer.invoke("address-cursor", dir),
|
|
togglePwFill: (rect) => ipcRenderer.invoke("toggle-pw-fill", rect),
|
|
onPwAvailability: (cb) => ipcRenderer.on("pw-availability", (_e, d) => cb(d)),
|
|
// Update chip: chrome subscribes to update-available; clicking the chip's
|
|
// download button opens the URL in the system browser; ✕ dismisses for
|
|
// the current session.
|
|
onUpdateAvailable: (cb) => ipcRenderer.on("update-available", (_e, d) => cb(d)),
|
|
openUpdateDownload: (url) => ipcRenderer.invoke("open-update-download", url),
|
|
dismissUpdate: () => ipcRenderer.invoke("dismiss-update"),
|
|
goHome: () => ipcRenderer.invoke("go-home"),
|
|
back: () => ipcRenderer.invoke("go-back"),
|
|
forward: () => ipcRenderer.invoke("go-forward"),
|
|
reload: (hard) => ipcRenderer.invoke("reload", !!hard),
|
|
stop: () => ipcRenderer.invoke("stop"),
|
|
toggleTor: () => ipcRenderer.invoke("toggle-tor"),
|
|
openSettings: () => ipcRenderer.invoke("open-settings"),
|
|
toggleSiteInfo: (rect) => ipcRenderer.invoke("toggle-site-info", rect),
|
|
switchToBcnr: () => ipcRenderer.invoke("switch-to-bcnr"),
|
|
setChromeHeight: (h) => ipcRenderer.invoke("set-chrome-height", h),
|
|
getSearchEngines: () => ipcRenderer.invoke("search-engines"),
|
|
setSearchEngine: (id) => ipcRenderer.invoke("set-search-engine", id),
|
|
addEngine: (eng) => ipcRenderer.invoke("add-engine", eng),
|
|
removeEngine: (id) => ipcRenderer.invoke("remove-engine", id),
|
|
toggleEnginePicker: (rect) => ipcRenderer.invoke("toggle-engine-picker", rect),
|
|
onEngines: (cb) => ipcRenderer.on("engines", (_e, d) => cb(d)),
|
|
getBookmarks: () => ipcRenderer.invoke("bookmarks-get"),
|
|
addBookmark: (bm) => ipcRenderer.invoke("bookmark-add", bm),
|
|
removeBookmark: (url) => ipcRenderer.invoke("bookmark-remove", url),
|
|
onBookmarks: (cb) => ipcRenderer.on("bookmarks", (_e, d) => cb(d)),
|
|
onNav: (cb) => ipcRenderer.on("nav", (_e, d) => cb(d)),
|
|
onTor: (cb) => ipcRenderer.on("tor", (_e, d) => cb(d)),
|
|
onTabs: (cb) => ipcRenderer.on("tabs", (_e, d) => cb(d)),
|
|
onAddressPicked: (cb) => ipcRenderer.on("address-picked", (_e, url) => cb(url)),
|
|
onBcnrOffer: (cb) => ipcRenderer.on("bcnr-offer", (_e, d) => cb(d)),
|
|
// Collision-mode (BCNR ↔ ICANN) live switcher for the active tab
|
|
collisionSwitch: (arg) => ipcRenderer.invoke("collision-switch", arg),
|
|
collisionState: () => ipcRenderer.invoke("collision-state"),
|
|
// Downloads — the toolbar button subscribes to `downloads` to update its
|
|
// badge, and toggleDownloads opens/closes the floating panel.
|
|
getDownloads: () => ipcRenderer.invoke("downloads-get"),
|
|
toggleDownloads: (rect) => ipcRenderer.invoke("toggle-downloads", rect),
|
|
onDownloads: (cb) => ipcRenderer.on("downloads", (_e, d) => cb(d)),
|
|
});
|