Multiple changes to add tray.#106
Conversation
Restore __static variable If tray exists but window is closed Minor changes. Reset timer if window is closed
|
Thanks for the work on this, @okgarces! I think this feature with Windows needs more work. Here's a screenshot: The window gets clipped off-screen. I think it's a matter of the window position calculation. I suggest that because the Windows (and probably Linux) implementations are ready yet, we make this a macOS only feature for the time being. |
| } else { | ||
| mainWindow.isVisible() ? mainWindow.hide() : mainWindow.show() | ||
| } | ||
| const position = getNewWindowPosition() |
There was a problem hiding this comment.
| const position = getNewWindowPosition() | |
| if (process.platform === 'darwin') { | |
| const position = getNewWindowPosition() | |
| mainWindow.setPosition(position.x, position.y, false) | |
| } |
There was a problem hiding this comment.
Thanks, I tested this weekend and I found the problem.
I am going to add the conditional. The current implementation in Windows and Linux brings the window to the center of the screen?
I think we can reuse this function to enable something like save the current window position. I want in this PR to set near to the tray icon. Right now, I am not sure if that is what we want.
There was a problem hiding this comment.
Yes, currently the window repositions to the center of the screen when restored from the tray. Ideally, it would either be placed near the tray (which is what you're working on), or in the last position.
I'd like to add the feature that the window position is remembered across sessions. I think the preferred default behavior is: remember last window position unless using the minimize-to-tray feature, in which case the window position is adjacent to the tray icon.
There was a problem hiding this comment.
Cool... I am going to make the proper changes and at the end of the day I will update the PR.
With this explanation, I will make sure that the minimize-to-tray feature works as we want.
Thanks a lot!
There was a problem hiding this comment.
@Splode I applied your suggestions. Let me know whatever I could improve.
Also, If this PR is closed I could work on the feature to remember position across sessions.
| mainWindow.isVisible() ? mainWindow.hide() : mainWindow.show() | ||
| } | ||
| const position = getNewWindowPosition() | ||
| mainWindow.setPosition(position.x, position.y, false) |
There was a problem hiding this comment.
| mainWindow.setPosition(position.x, position.y, false) |
There was a problem hiding this comment.
If I remove this the window will not be shown near to the tray icon. Still, do I remove it?
|
@okgarces Thanks for all the work on this! This is a great step toward better tray support for all 3 platforms. 💯 |

I closed this #76 and here I have a new without Style changes.
Also, I implemented an approach when tray icon is at the bottom. However, I need to test it on Windows.