From cf0951b7540b35175b27ecded3bc142c497ca14e Mon Sep 17 00:00:00 2001 From: Local Dev Date: Tue, 8 Sep 2026 07:53:48 +0200 Subject: [PATCH] feat(theseus/find): Ctrl+F opens an in-page find bar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Standard browser Ctrl+F support: - main.js: Ctrl+F caught in the shared before-input-event handler (same place as F12 / reload shortcuts) fires 'find-open' to chrome. Two new IPC handlers proxy to activeTab().view.webContents: find-in-page(query, {forward, findNext, matchCase}) find-stop Each tab's webContents listens for 'found-in-page' and forwards {activeMatchOrdinal, matches, finalUpdate} back to chrome via 'find-result' — only when it's the active tab so the bar doesn't update from a background tab's stale match count. - preload.js: exposes onFindOpen / findInPage / findStop / onFindResult. - chrome.html: adds a .findbar strip below the bookmarks bar (part of chrome-view height like .tordisc / .bcnrbar, so syncHeight picks it up). Input + "N of M" counter + prev/next/close buttons. Enter jumps next, Shift+Enter previous, Esc closes. Typing runs findNext:false (fresh search); pressing Enter runs findNext:true (walk matches). No-match state paints the input border red. --- chrome.html | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++ main.js | 35 +++++++++++++++++++++++++ preload.js | 7 +++++ 3 files changed, 115 insertions(+) diff --git a/chrome.html b/chrome.html index 2e775a80..f2159b52 100644 --- a/chrome.html +++ b/chrome.html @@ -295,6 +295,18 @@ .logo .gear { font-size: 12px; opacity: .8; } /* favorites bar — new-tab page only, single compact row */ .bookmarks { display: flex; align-items: center; gap: 4px; padding: 3px 10px 5px; height: 26px; overflow: hidden; } + /* Ctrl+F find-in-page bar. Sits below the address bar (above tabs body), + ~32px tall so it's part of the chrome view height like .tordisc / .bcnrbar. + syncHeight in the tabs handler picks it up automatically. */ + .findbar { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-top: 1px solid var(--line); background: var(--surface); } + .findbar input { flex: 1; min-width: 120px; padding: 4px 8px; border-radius: 6px; background: var(--surface2); color: var(--ink); + border: 1px solid var(--line); font: inherit; font-size: 12.5px; outline: none; } + .findbar input:focus { border-color: color-mix(in srgb, var(--acid) 55%, transparent); } + .findbar input.nomatch { border-color: rgba(246,118,138,.55); background: rgba(246,118,138,.10); } + .findbar .findcount { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; min-width: 46px; text-align: right; } + .findbar .findbtn { border: 1px solid var(--line); background: var(--surface2); color: var(--ink); border-radius: 6px; + padding: 3px 8px; font-size: 13px; cursor: pointer; } + .findbar .findbtn:hover { background: var(--surface); border-color: color-mix(in srgb, var(--acid) 35%, transparent); } .bm { display: flex; align-items: center; gap: 6px; max-width: 180px; padding: 3px 9px; border-radius: 6px; background: var(--surface2); border: 1px solid var(--hover); color: var(--mut); font-size: 12px; cursor: pointer; white-space: nowrap; } .bm:hover { background: var(--active); color: var(--ink); } @@ -397,6 +409,13 @@
+