timche / gmail-desktop

:postbox: Nifty Gmail desktop app for macOS, Linux & Windows
MIT License
845 stars 90 forks source link

Support starting app minimized to tray #158

Closed cyfrost closed 5 years ago

cyfrost commented 5 years ago
  1. Uses the new --start-minimized command line switch to decide if the app should start minimized.
  2. Bug fix: The tray context menu item "Show" wasn't being updated. Meaning, when the app is open, tray should say "Hide" and vice-versa. This has now been fixed.

Verified these changes on Linux and Windows, someone else has to dirty test it on macOS.

Thoughts?

mskelton commented 5 years ago

@cyfrost What are the use cases for starting the app minimized? I'm assuming there are good use cases but I'm not familiar with what that might be.

cyfrost commented 5 years ago

@markypython, On Linux, my use-case is to have Gmail run at startup but minimized to the tray (to save it blasting open on my face on every boot). Other than that though, I can't think of anything else.

timche commented 5 years ago

Thanks for this PR @cyfrost! As I find this feature quite useful as well, I'd like to have it configurable through the menu bar in Settings too. Could you implement that as well please?

cyfrost commented 5 years ago

@timche, did you mean to have a "Auto start as minimized" option?

timche commented 5 years ago

Correct. More like Start minimized maybe?

cyfrost commented 5 years ago

Correct. More like Start minimized maybe?

@timche, I'm trying to understand: "Start minimized" can mean different things, for instance, when "Start minimized" is enabled and the user voluntarily opens Gmail from Launchpad / Dock or another app launcher in a different OS, it will start silently in the tray, And the another meaning could be that "Start Minimized" will actually auto-start Gmail at system startup minimized to the tray. Which of these did you mean?

timche commented 5 years ago

You are right @cyfrost. Probably a better name could be Launch minimized? It shouldn't auto-start on boot.

cyfrost commented 5 years ago

@timche, that has been added. We'll now have two ways to launch Gmail in minimized view. 1) append the --start-minimized switch when running via CLI (like gmail --start-minimized) and 2) Simply via the Settings > Launch Minimized option. Thoughts?

This also helps if the user wants to make it open minimized to tray at auto-start on boot. They can simply enable Launch Minimized and then add Gmail to their Startup apps list via System Preferences and it should start minimized.

I've verified these working on Linux and Windows, can someone test this "Start Minimized" on macOS? Thanks!

image

timche commented 5 years ago

Sorry for the slow progress on my side. First, thanks for implementing this, can't wait to have this feature in!

Would it be possible to have the argument called --launch-minimized as well to have it aligned with how the setting is called?

Will test this on macOS.

cyfrost commented 5 years ago

Heh, no worries. I understand people have a life outside GitHub too ;)

timche commented 5 years ago

I'm getting this error when I try to start it on macOS:

image

cyfrost commented 5 years ago

@timche My bad, sorry. The trayContextMenu.getMenuItemById was supposed to handle the change between "Show" and "Hide" in the Tray icon of Gmail under Linux and Windows, but since a Tray instance won't be created for macOS, we now have a check for that.

timche commented 5 years ago

Released in v2.13.0

timche commented 5 years ago

@all-contributors please add @cyfrost for code, maintenance

allcontributors[bot] commented 5 years ago

@timche

I've put up a pull request to add @cyfrost! :tada: