Skip to content

Panels: no transparent background and no size from the content, so a popup card shows an opaque window around it #315

Closed

Description

@houko

Context

Line numbers are at aadbe7e; main at 6160fe6 has the same code.

  • PanelOptions holds Width, Height, HideOnBlur and Material (core/window.go:58-66). The size is fixed at open, and there is no option for a window with no background.
  • On macOS, newPanel makes a titled NSPanel ("titled for its rounded corners and shadow", internal/platform/macos/app.go:137-163) of exactly that size. The window stays opaque with the window background colour unless a material is set; setMaterial makes it non-opaque only to put an NSVisualEffectView over the whole content (internal/platform/macos/material.go:75-102), and WindowMaterialNone "keeps the window opaque" (internal/driver/services.go:105-106).
  • OpenWindow has no transparent option either; docs/roadmap.md:107 lists "Transparent windows and the taskbar on Windows" as future work, and nothing names it for macOS or for panels.
  • The only way to fit the panel to its content is to measure the content and send desktop.SetWindowFrame with a size from inside the panel (desktop/desktop.go:163), after it has already shown at the size it was opened with.

#243 (and its comment) is about where a panel goes and whether it takes the keyboard; this issue is about what it looks like and how big it is.

Why it matters

A quick-lookup or command popup is a card: rounded, with its own shadow, often shorter than its maximum height when the result is short. Desktop toolkits draw such a popup as a borderless, transparent, shadowless window sized to the card (an NSPanel with isOpaque = NO, a clear background and the card's own shadow on macOS; a layered window on Windows). With NSGo's panels the app gets a fixed rectangle with the window background and the system's rounded corners and shadow around all of it, so a 380×520 panel showing a two-line result is a large empty block under a small card. Using a material does not help: it frosts the whole rectangle. Resizing with SetWindowFrame from the content after it shows can put a frame at the old size on screen first, and has to be redone on every content change.

Proposal

  1. PanelOptions.Transparent bool (and the same on WindowOptions, which the roadmap item already wants on Windows): the window draws nothing of its own, no background, no system frame or shadow, so only what the app draws shows and the rest lets clicks through or not as the platform allows. On macOS: a borderless non-activating panel (NSWindowStyleMaskBorderless | NSWindowStyleMaskNonactivatingPanel), setOpaque:NO, setBackgroundColor:clearColor, setHasShadow:NO, with the content view's layer clear; the app's view draws its corners and BoxShadow, which then needs room inside the window. On Windows, a layered or DirectComposition window with a transparent background; on Linux, an RGBA visual where a compositor runs, falling back to opaque and reporting it.
  2. PanelOptions.FitContent (or Width/Height of core.FitContent): the panel takes the content root's measured size, up to Width/Height as a maximum, before it first shows and again as the content's size changes, keeping its anchored edge (the top under a tray icon, or the placement Panels that never take the keyboard and can be placed at a screen rectangle (candidate windows, on-screen keyboards) #243 adds).
  3. Env reports whether transparency took effect, like Env.WindowMaterial does for materials, so an app can draw a background when it did not.

Acceptance

  • On macOS, a Transparent panel whose content is a rounded view with a BoxShadow shows only that view and its shadow; the desktop shows through everywhere else.
  • A FitContent panel opens at its content's height, never shows at the maximum first, and follows the content when it grows or shrinks.
  • Panels without the new options look and size as today.
  • Windows and Linux either support both options or report through Env that they did not apply.

Activity

  1. houko commented on Nov 17, 2026

    @houko
    CollaboratorAuthor

    Related: #567 asks for the same transparent, shadowless look on OpenWindow windows (plus SkipTaskbar), and #568 for letting the pointer through such a window where it draws nothing. A desktop pet or a floating widget opened as a NoActivate panel needs the transparent background from this issue too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions