8000 Add event to tray notification when other item is being selected · Issue #8689 · electron/electron · GitHub
[go: up one dir, main page]

Skip to content
Add event to tray notification when other item is being selected #8689
@pronebird

Description

@pronebird

Hi,

I build a menubar app and use Tray to display window below menubar item.

I use the following implementation:
https://github.com/kevinsawicki/tray-example

When user clicks on menubar item it highlights, i.e.:

tray.on('right-click', toggleWindow);
tray.on('double-click', toggleWindow);
tray.on('click', toggleWindow);

window.on('show', () => {
  tray.setHighlightMode('always');
});

window.on('hide', () => {
  tray.setHighlightMode('never');
});

However if user switches between menubar items the tray item remains selected which is against how things are naturally handled on macOS. On macOS the majority of apps hide the corresponsding menus or popovers when other menubar item is being selected. I am sure that holds true for Windows as well.

Also since I am not able to track when that happens, there is nothing I can do to hide the displayed window.

The proposal is to have an event or certain capability to track when user switches between menubar items.

  • Electron version: 1.5.0
  • Operating system: macOS

Expected behavior

Actual behavior

How to reproduce

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0