Run as minimized on startup

The Problem

Whenever I restart my PC I usually don’t like having applications start up and be in my face so suddenly.

Proposed Solution

I would like to have Mailspring just run on startup without opening a window.

Alternative Solutions

None, I’m pretty sure this is not in the settings. I don’t want to disable the open on startup feature.


Applies to Windows, macOS, and Linux. (Seven upvotes.)

I don’t know if this is a bug or maybe a request for a new feature.

I want Mailspring to launch at startup and minimized (in the background) to the notification area in Windows 10. At the moment it always starts open in my screen. I then have to click ‘x’ to send it to the notification area.

I’ve tried ‘run minimized’ in the properties of the shortcut but that doesn’t work. I’ve also created a task in Task Scheduler to ‘\background’ but still it doesn’t stop it launching.

I may be missing something but it would be nice for it to go straight to the notification area at startup.

Thanks for a great email client!

Running: Mailspring 1.7.6 (latest version)
Windows 10 Home

(Originally posted by paulhypno).

Hey folks! It looks like the --background / -b option doesn’t help much on Windows… there doesn’t seem to be a way to pass command line flags to the applications listed in Task Manager > Startup, which is what you’d need to do. I wonder if you could create a cmd / bat file of some sort that just launched Mailspring and passed the --background flag? I’m not much of a Windows user unfortunately.

If anyone has a better solution here I’d be happy to try to incorporate it into the app. I think similar to your eMClient example, you could do:

cd "~\AppData\Local\Mailspring"
start mailspring.exe --background

(Originally posted by bengotow on GitHub.)

This --background simply doesn’t work on Windows - when I execute above in the shell, it still didnt minimize.
This has nothing to do with Windows startup features (ofc there is a way to pass args to the startup entry on Windows)

The only way I found is to automate it via Autohotkey script:

Run, mailspring.exe
WinWaitActive, ahk_exe mailspring.exe

This can be compiled to small exe and could be added to startup instead of mailspring itself. This can be easily replicated inside mailspring itself upon startup, although one may need to call WIN32 API directly.

Other way would be to actually start with hidden window (not minimized) and unhide it once user clicks tray icon.

(Originally posted by majkinetor on GitHub.)

There is another related bug about this, which is confirmed as of July 2020.

I think, I figured out what is the issue. On Linux, when the Mailspring window is maximized, when Mailspring is closed, on the next start, the maximize() method is called in app-env.ts line 566. This will automatically show the Mailspring window even if it was started in the background correctly. This does not happen on MacOS, as this is only called when the OS type does not equal darwin.

Code in question – app-env.ts:

  restoreWindowDimensions() {
    let dimensions = this.savedState.windowDimensions;
    if (!this.isValidDimensions(dimensions)) {
      dimensions = this.getDefaultWindowDimensions();
    if (dimensions.maximized && process.platform !== 'darwin') {
    if (dimensions.fullScreen) {

I am going to provide a bugfix which will work on Linux and may also work on Windows machines: