Skip to content

Menubar window is incorrectly positioned when opened while the tray icon is hidden on Windows #438

@leolabs

Description

@leolabs

Description

I'm working on an app that runs in the menubar and opens its window on launch. This works well when the tray icon is visible on Windows, but when it isn't, the window is incorrectly positioned as if it was horizontally centered around x=0. Pinning the tray icon to the tray area solves the problem but it still looks weird to first-time users.

CleanShot.2023-03-26.at.22.54.26.mp4

Steps to Reproduce the Problem

I instantiated menubar with these settings:

const mb = menubar({
  preloadWindow: true,
  icon: `AppIcon.png`, // abridged for brevity
  index: "http://localhost:3009/",
  browserWindow: {
    width: 420,
    height: 460,
    resizable: false,
    vibrancy: "popover",
  },
});

mb.on("ready", () => {
  mb.showWindow();
});

Expected Behaviour

When the tray icon's position is unknown, the window should be positioned on the bottom right as a fallback.

Actual Behaviour

The window is partially hidden on the bottom left of the screen.

Specifications

  • Menubar version: 9.3.0
  • Platform: Windows
  • Electron version: v16.2.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions