Repository navigation
fix: v1.5.1 — hide .app-titlebar-icon overlapping traffic lights - #60
Conversation
… lights The web app's SVG logo in .app-titlebar-icon sits at the far left of the custom title bar. With .fullSizeContentView (v1.5.0) that region now includes the traffic lights, so the icon overlaps the close button. Injected documentStart WKUserScript that appends a <style> element hiding .app-titlebar-icon inside the Mac wrapper. No web UI change needed. Closes #59.
nesquena
left a comment
There was a problem hiding this comment.
Verified on Mac agent at tip eb47c86.
Build/test results
swift build -c release— Build complete (2.43s, 0 warnings)swift test— 22/22 passedbash build.sh—.appbuilt, ad-hoc signed, installed to/Applications
Scope: 25/-0 across 2 files (CHANGELOG + BrowserWindowController). Pure addition.
Code review
Single WKUserScript injection, all four moving parts correct:
-
Timing —
injectionTime: .atDocumentStart. Runs before any web content. The IIFE handles the documentStart case wheredocument.headmay not exist yet (parser hasn't reached<head>yet) via the fallback:(document.head || document.documentElement).appendChild(s). Both placements are valid for<style>— browsers process style elements regardless of position. -
Scope —
forMainFrameOnly: true. The web app's title bar is in the main document, not an iframe. Correct scope; avoids unnecessary work on any embedded iframes. -
CSS rule —
'.app-titlebar-icon { display: none !important; }'. Class selector targets just the icon element. The!importantqualifier wins over any author rule giving the icon a layout — necessary because the web app must have somedisplayrule for the icon to render in the first place. No other elements affected. -
String safety. The CSS rule is a static string literal — no user-controlled data interpolated. No XSS surface.
Lifecycle considerations:
- Reload (incl. v1.5.0
reconnectInPlacepaths): WebKit re-runs all registeredWKUserScripts on every main-frame navigation, so the style element is re-injected on each reload. The hide persists. - SPA route changes: documentStart scripts don't re-fire for in-app navigations, but the injected
<style>element stays in the DOM unless the SPA replacesdocument.headwholesale (atypical for React/Vue). No re-injection needed. - Element timing race: the SPA renders the icon AFTER our CSS is in the DOM, so
display: none !importantapplies as soon as the element is created and matches the selector. No race window.
Non-blocking follow-ups
- Coordination with the web side. If hermes-webui ever wants the icon visible only on web (and hidden in Mac), they could add a class/data attribute to differentiate environments — at which point this Mac-side hide becomes redundant. Worth a comment in the web repo's title-bar component pointing back at this Swift fix so future web changes don't accidentally reintroduce the overlap by renaming
.app-titlebar-icon.
Ready to merge and tag v1.5.1.
Summary
Hotfix for the icon overlap introduced by v1.5.0's
.fullSizeContentViewchange.Problem
The web app's
.app-titlebarhas a small SVG Hermes logo (.app-titlebar-icon) at the far left. Before v1.5.0 this sat below the native title bar. After v1.5.0 the content view extends under the title bar, so the icon renders right next to the traffic lights — overlapping the ✕ close button.Fix
One
WKUserScriptinjected atdocumentStartthat appends a<style>element hiding.app-titlebar-iconinside the Mac wrapper. The rest of the title bar (title text, connection badge, controls) is completely unaffected. No change to the web UI is needed.Pre-merge checklist
Closes #59