-
-
Notifications
You must be signed in to change notification settings - Fork 434
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
Fixes #110 #134
Fixes #110 #134
Conversation
@Lplenka It'll be great if you use different branch than master to create pull request. |
|
app/renderer/js/tray.js
Outdated
window.tray = null; | ||
} | ||
} else { | ||
window.createTray(); |
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.
should be createTray()
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.
Yes, will change it.
Size issue on different OS. Have to make the config OS specific. |
The one big problem with this PR is that we don't want to completely replace the tray icon with that canvas image. The ideal solution is to set that canvas on top of Zulip tray icon. Something like this - So that it look like this - You gotta use |
Okay, Since there is no support to overlay tray in Linux & MacOS I thought this will work for the time being. Because we cannot implement something which electron doesn't have itself. |
The original zulip Icon will always be there if no unread messages are present. |
Definitely, it makes sense. It's probably a good fix until electron supports this api on macOS + Linux 😃 |
Yes, we can handle this differently in different OS. If Windows has overlay we can use that, but then we will have a different implementation in different OS. Would that be fine? |
Yes. |
For the webapp, we just have a collection of 100 generated images that we use for favicons (if the number exceeds 100, we just show an infinity symbol). So one doesn't need overlay support -- just the ability to change the image -- to produce arbitrary numbers. |
@timabbott yes I feel like that's the only one more possible way to deal with this Issue. This approach is even easier to implement than the way I used i.e. generate new canvas every time a new message comes. But here is twist we have to make 100 icons for Windows, 100 for Linux and 100 for MacOS because tray Icon size differs in three of them I couldn't make those icons for all OS. Found html canvas is the only way till Electron supports overlay for all OS. |
I think we could get these favicons using - page.on('page-favicon-updated', (event, favicons) => {
console.log(favicons.slice(-1)[0]);
}); output - ➜ zulip-electron git:(master) ✗ npm start
> zulip@0.5.8 start /Users/akka/dev/zulipwork/zulip-electron
> electron ./app/main
Wait for app ready
Server StatusCode: 200
You are connected to: chat.zulip.org
https://chat.zulip.org/static/images/favicon/favicon-38.png
https://chat.zulip.org/static/images/favicon/favicon-93.png
https://chat.zulip.org/static/images/favicon/favicon-93.png
https://chat.zulip.org/static/images/favicon/favicon-93.png I was just wondering if somehow we could set these favicon to our tray icon 🤔 |
We can receive the image using http request to specific URL like
But I think size issue will still remain for different OS 😕 |
Will try to run this PR on windows tonight plus I'll see if we could use |
Okay 👍 |
Will review it again on Monday. |
Does it work on Windows 10? Can you paste a screenshot? |
Please move this file -
|
@akashnimare Is this necessary?
Initially, I tried running this file in I have added every functionality of Tray icon using Also if Tray icon is in renderer process it will be helpful to add required functionalities for our "Multiple Server Support" feature. |
You can't import tray.js in Main process since it belongs to Renderer.
Make sense. |
@Lplenka why does it create multiple tray icon in some cases (ex. navigating to a new URL)? Although it gets disappeared after few seconds. Can we prevent this event? |
I meant currently our app does that, we import While In this PR since I shifted tray.js file to renderer, I am just calling this file in |
Yes I specifically dealt with this problem in
This probably happens because @akashnimare I am sure this part of code dealt with the problem you mentioned because I don't find this problem anymore. I can share the gif if you want. |
Cross tested this PR on all the platforms. Works great. This is probably the best solution to show unreadcounts in the tray icon. We could improve it later once electron officially support it with Note - Sorry for the delay. Thanks for all the work 🚀 ❤️ |
Thanks! 😄 and yes I will definitely work on that as soon as required feature is implemented in Electron. |
There was no support for showing unread count in the Tray icon, I have added the functionality.
There is no support for overlay icon in Linux as of now please refer issue #9020.
This fix works fine.
Any suggestions are welcome 😄