fix: Windows overlay not visible (CSS url backslash + transparent compositing + follow active screen) - #4
Open
touful wants to merge 1 commit into
Open
Conversation
…indow compositing + follow active screen)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3
Summary
Three fixes for the Windows overlay not being visible on screen (verified on Windows 11, opencode 1.18.18, v1.0.2 overlay):
CSS
url()backslash break (Windows paths) —bridge.ctsbuiltfile://${spritesheetPath}from apath.resolve()result (C:\Users\...). Backslashes are escape characters in CSSurl(), so the background-image value became corrupted (observed via CDP:url("file://C:Userstouful...")). Fixed by normalizing to forward slashes +file:///prefix in:preload/bridge.cts(getSpritesheetPath)renderer/app.ts(onSwitchPet, same pattern)main/window.ts(passes the normalized path via--spritesheet-path)Fully-transparent window never composited on some Windows environments — with
backgroundColor: "#00000000"(+ theopacity: 0.9999999hack) the window content is rendered (visible via CDPPage.captureScreenshot) but never presented to the screen (screen capture shows whatever is underneath). Changing tobackgroundColor: "#01000000"(alpha = 1/255, visually transparent) +opacity: 1.0makes the pet visible with a transparent background.Pet follows the active screen — the overlay positioned itself on the primary display (
getPrimaryDisplay()), which on multi-monitor setups may not be where the user is working. Replaced withgetActiveWorkArea()which uses the display under the cursor (falls back to primary).Verification
Tested by unpacking the v1.0.2 release
app.asarand applying the same changes todist/:background-image: url("file://C:Userstouful...")(broken URL), image never loadsurl("file:///C:/Users/touful/.opencode-pets/overlay/resources/app/assets/pets/gutsy/spritesheet.webp"), image loads 1536x1872Notes
winOnlyis still used forthickFrame, so theopacity: 1.0change does not orphan it.0.9999999opacity hack becomes unnecessary once the background alpha is non-zero.