Skip to content

feat: migrate custom macOS tray view to native one - #18981

Merged
MarshallOfSound merged 10 commits into
masterfrom
intern/trayicon
Jul 31, 2019
Merged

MarshallOfSound merged 10 commits into
masterfrom
intern/trayicon

Conversation

@deermichel

@deermichel deermichel commented Jun 25, 2019 •

Copy link
Copy Markdown
Contributor

Description of Change

Under macOS Catalina the current custom Tray implementation stops working since we're using deprecated methods (see #18664). This PR uses native methods of [NSStatusItem button] where applicable. Closes #18664.

Discussion

I got all previously available methods & events working except for tray.setHighlightMode(mode). Imho we should drop support for this mac-only method because we'll have a hard time finding ways to sneak in Apple's native menu handling. However, we are still able to control highlighting when no menu is set (i guess that's where most use cases for this method are found anyway). Probably should be further discussed in a Releases WG meeting. If someone knows a way around that all, feel free to dm me. --> Verdict: Deprecate in 6, remove in 7.

cc @codebytere @MarshallOfSound @miniak @erickzhao

Checklist

Release Notes

Notes:

  • Migrated Tray from custom to native view to be compatible with Catalina (macOS).
  • Removed deprecated Tray.setHighlightMode method (macOS).

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Jun 25, 2019
@codebytere
codebytere requested review from MarshallOfSound and miniak and removed request for MarshallOfSound and miniak June 26, 2019 01:27
@deermichel
deermichel marked this pull request as ready for review June 26, 2019 20:24
@deermichel
deermichel requested a review from miniak June 26, 2019 20:24
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Jun 26, 2019
@deermichel
deermichel force-pushed the intern/trayicon branch 4 times, most recently from d7a21df to c391f6a Compare July 2, 2019 23:56
@deermichel

Copy link
Copy Markdown
Contributor Author

Confirmed to work under macOS Catalina Beta 🎉

@deermichel
deermichel force-pushed the intern/trayicon branch 3 times, most recently from f9201fa to b146491 Compare July 10, 2019 18:06
@deermichel deermichel changed the title [wip] feat: migrate custom macOS tray view to native one feat: migrate custom macOS tray view to native one Jul 10, 2019
@deermichel deermichel mentioned this pull request Jul 10, 2019
5 tasks done
@deermichel

deermichel commented Jul 10, 2019 •

Copy link
Copy Markdown
Contributor Author

Should be merged after #19202 ✅

@codebytere
codebytere self-requested a review July 15, 2019 16:41
Comment thread shell/browser/ui/tray_icon_cocoa.mm Resolved
Micha Hanselmann and others added 9 commits July 31, 2019 08:54
* fix: make tray not block main process

* make AtomMenuModel refcounted
* chore: use ScopedPumpMessagesInPrivateModes in tray

* revert refcounting of AtomMenuModel

* Prefer WeakPtr for posting tasks to handle unexpected destruction
add missing include
@deermichel

Copy link
Copy Markdown
Contributor Author

Ready

@codebytere

Copy link
Copy Markdown
Member

@deermichel release notes need to be fixed up it seems.

@MarshallOfSound
MarshallOfSound merged commit 47a38da into master Jul 31, 2019
@release-clerk

release-clerk Bot commented Jul 31, 2019

Copy link
Copy Markdown

Release Notes Persisted

  • Migrated Tray from custom to native view to be compatible with Catalina (macOS).
  • Removed deprecated Tray.setHighlightMode method (macOS).

@MarshallOfSound
MarshallOfSound deleted the intern/trayicon branch July 31, 2019 17:52
@miniak

miniak commented Jul 31, 2019

Copy link
Copy Markdown
Contributor

/trop run backport-to 7-0-x

@trop

trop Bot commented Jul 31, 2019

Copy link
Copy Markdown
Contributor

The backport process for this PR has been manually initiated,
sending your 1's and 0's to "7-0-x" here we go! :D

@trop

trop Bot commented Jul 31, 2019

Copy link
Copy Markdown
Contributor

I was unable to backport this PR to "7-0-x" cleanly;
you will need to perform this backport manually.

@donkooijman

Copy link
Copy Markdown

Hi, @deermichel

However, we are still able to control highlighting when no menu is set (i guess that's where most use cases for this method are found anyway)

How can we do this?

@sulf

sulf commented Apr 15, 2020

Copy link
Copy Markdown

Hey @deermichel,

However, we are still able to control highlighting when no menu is set (i guess that's where most use cases for this method are found anyway)

We've been looking at the same issue, but cannot find any documentation.

@donkooijman

Copy link
Copy Markdown

^ This can be achieved by setting an empty context menu on the tray. @sulf

const contextMenu = Menu.buildFromTemplate([]);
tray.setContextMenu(contextMenu);

@CahierX

CahierX commented Dec 17, 2021

Copy link
Copy Markdown

I set empty array click tray is not highlight, is not work

@CahierX

CahierX commented Dec 17, 2021

Copy link
Copy Markdown

How did you do it, I encountered the same problem

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace StatusItemView implementation with [NSStatusItem button]

7 participants