Skip to content

Linux: tray icon shows but menu doesn't appear on right click #7823

Open
@fnune

Description

@fnune

NWJS Version: 0.59.1
Operating System: Linux 5.15.10-arch1-1 (GNOME 41)

Expected behavior

When I right-click the tray icon, the menu shows up.

Actual behavior

The menu doesn't show up.

How to reproduce

Copy the code from the documentation into bg-script.js:

// Create a tray icon
var tray = new nw.Tray({ title: 'Tray', icon: 'icon.png' });

// Give it a menu
var menu = new nw.Menu();
menu.append(new nw.MenuItem({ type: 'checkbox', label: 'box1' }));
tray.menu = menu;

Use the following index.html:

<!DOCTYPE html>
<html lang="en">
<head>
  <title>App</title>
</head>
<body>
<h1>App</h1>
</body>
</html>

Set "bg-script" to "bg-script" and "main" to "index.html" in package.json.

Install nw with yarn add nw.

Run yarn run nw.

Observe that the window shows correctly and the tray icon appears, but right-clicking it doesn't show the menu.

Different observations:

  • If I set a tooltip it actually shows kind of like a menu.
  • Haven't been able to debug with --remote-debugging-port. The port simply has nothing in it.

nw output:

 ~/Development/joinable [1] => yarn run nw
yarn run v1.22.11
$ /home/user/Development/joinable/node_modules/.bin/nw
[110604:110632:1222/164830.623278:ERROR:chrome_browser_main_extra_parts_metrics.cc(226)] crbug.com/1216328: Checking Bluetooth availability started. Please report if there is no report that this ends.
[110604:110632:1222/164830.623316:ERROR:chrome_browser_main_extra_parts_metrics.cc(229)] crbug.com/1216328: Checking Bluetooth availability ended.
[110604:110632:1222/164830.623343:ERROR:chrome_browser_main_extra_parts_metrics.cc(232)] crbug.com/1216328: Checking default browser status started. Please report if there is no report that this ends.
[110604:110632:1222/164830.634495:ERROR:chrome_browser_main_extra_parts_metrics.cc(236)] crbug.com/1216328: Checking default browser status ended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions