-
Notifications
You must be signed in to change notification settings - Fork 15k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: allow Tray with title only (without icon) on Mac #13851
Conversation
77ef005
to
7169f59
Compare
atom/browser/api/atom_api_tray.cc
Outdated
mate::Handle<NativeImage> image; | ||
if (!args->GetNext(&image)) { | ||
#if !defined(OS_MACOSX) | ||
args->ThrowError("'image' must be defined"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An image must be provided as the first argument of the `Tray` constructor
docs/api/tray.md
Outdated
@@ -60,9 +60,10 @@ rely on the `click` event and always attach a context menu to the tray icon. | |||
|
|||
### `new Tray(image)` | |||
|
|||
* `image` ([NativeImage](native-image.md) | String) | |||
* `image` ([NativeImage](native-image.md) | String | null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although less semantic I'm not a fan of having an argument that can be null
on one platform but would throw errors on another. A static type checker (typescript for example) wouldn't be able to warn you about these issues.
Can we instead recommend that uses provide nativeImage.createEmpty()
if they wish to have a tray with no icon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarshallOfSound I will investigate that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feedback RE usage semantics and errors
7169f59
to
0eb5421
Compare
@miniak, @MarshallOfSound, what is the status of this? It's been idle for ~2 wks |
@ckerr pending on my |
8798524
to
ed0495d
Compare
@MarshallOfSound you're right, it can easily be done without changing the API by handling |
@miniak Can you please resolve conflicts here? |
ed0495d
to
80b0ce1
Compare
@alexeykuzmin done |
@miniak |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A test maybe?
@alexeykuzmin it cannot be tested as it's just a visual change |
80b0ce1
to
124e7c1
Compare
tray = new Tray(nativeImage.createEmpty()) | ||
}) | ||
beforeEach(() => { | ||
tray = new Tray(nativeImage.createEmpty()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have a test on Mac creating a Tray
without an icon?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is how you do it without the icon, it does not accept null
@MarshallOfSound can you please unblock the PR? |
124e7c1
to
135ab20
Compare
the reason why the PR was blocked has been addressed, cannot get a response now
@alexeykuzmin can we get it merged? |
@miniak, I don't have a permission to merge in |
Release Notes Persisted
|
An error occurred while attempting to backport this PR to "2-0-x", |
We have automatically backported this PR to "3-0-x", please check out #14384 |
Description of Change
Fixes #13202
Checklist
npm test
passesRelease Notes
Notes: Allow Tray with title only (without icon) on Mac.