diff --git a/chrome.html b/chrome.html index 6118f399..b96af37b 100644 --- a/chrome.html +++ b/chrome.html @@ -757,7 +757,13 @@ } langBtn.onclick = () => { const r = langBtn.getBoundingClientRect(); - T.websiteLanguageMenu && T.websiteLanguageMenu({ x: Math.round(r.left), y: Math.round(r.bottom + 4) }); + // Pass the chip's full rect — main anchors the dropdown's TOP-RIGHT + // under the chip's bottom-right, so x+width is where we want the + // picker's right edge to land, and y+height sets its top. + T.websiteLanguageMenu && T.websiteLanguageMenu({ + x: Math.round(r.left), y: Math.round(r.top), + width: Math.round(r.width), height: Math.round(r.height), + }); }; // Locale is optional (older main.js won't expose it) — render on settings // either way so the chip works even without it. diff --git a/lang-picker-preload.js b/lang-picker-preload.js new file mode 100644 index 00000000..13252843 --- /dev/null +++ b/lang-picker-preload.js @@ -0,0 +1,10 @@ +const { contextBridge, ipcRenderer } = require("electron"); +contextBridge.exposeInMainWorld("langpicker", { + onState: (cb) => ipcRenderer.on("lang-picker-state", (_e, d) => cb(d)), + pick: (tag) => ipcRenderer.invoke("lp-pick", String(tag || "")), + translate: () => ipcRenderer.invoke("lp-translate"), + revert: () => ipcRenderer.invoke("lp-revert"), + openSettings: () => ipcRenderer.invoke("lp-open-settings"), + close: () => ipcRenderer.invoke("lp-close"), + resize: (h, w) => ipcRenderer.invoke("lp-resize", h, w), +}); diff --git a/lang-picker.html b/lang-picker.html new file mode 100644 index 00000000..b21372fe --- /dev/null +++ b/lang-picker.html @@ -0,0 +1,157 @@ + + + + + + + diff --git a/main.js b/main.js index 0c7f2d29..e1bfb565 100644 --- a/main.js +++ b/main.js @@ -2103,6 +2103,12 @@ const POP_W = 360; let popH = 210; // popH is updated to fit the popover's conte // engine favicons, like Firefox — a native