Nylas-mail: "Launch on system start" not available on Linux

Created on 9 Feb 2016  Â·  42Comments  Â·  Source: nylas/nylas-mail

I do not know if this was an oversight, by design, or a technical limitation, but the new "launch on system startup" option found in the Windows builds is not present. Instead there is the option "show icon in menu bar" which is not found under Windows.

Is it possible to add this feature? I would love for N1 to start minimized when I startup my system

linux

Most helpful comment

I can confirm that the following command from xZero707 does work for Mailspring 1.7.8 installed via Snap:

ln -sf /var/lib/snapd/desktop/applications/mailspring_mailspring.desktop ~/.config/autostart/mailspring.desktop

:+1:

It would be nice if Mailspring supported this functionality out of the box for the Snap, maybe one day, who knows.

All 42 comments

Thanks for the request @brittyazel. It is a technical limitation on the Linux platform. There are many ways to handle launching N1 at startup on Linux. This includes .xinitrc, XDG autostart, WM-specific autostart, and systemd user sessions.

What I do not know is if there is a command line option to start N1 minimized. If there is such an option, then it would be as simple to create an entry in your method to run at startup minimized using that option.

I use Arch Linux as my daily driver on both my desktop and laptop. I understand that people have different needs under the Linux ecosystem. I use the i3 tiling window manager, and I would run Nat startup through anexeccall in my~/.config/i3/configbecause that is the easiest and most central place to manage processes at startup after the whole X11 display started up assystemd` user sessions are a little bit finnicky.

I too use Arch Linux as my daily driver. I know that some apps can start in the background, as I used to use Geary (before it was abandoned) and it would start in the background. And dropbox does the same. Now whether or not it is an app-specific thing or a Linux desktop thing, I have no clue :-/

Yay another Arch Linux user here. That sucks about Geary. N1 has the ability to start background, and it is available through the --background command line option. Have fun!

On another note, if you have plugin issues, please run sudo chmod 755 /usr/share/nylas/resources/app/apm/bin/node /usr/share/nylas/resources/app/apm/bin/apm.

You are correct, nylas --background did result in it opening up in the background. That being said, the way Gnome has programs launch on start is by putting a .desktop file in ./config/autostart - which is the way that Geary did it. Clicking the toggle just dropped a .desktop file in the autostart folder with the --hidden command appended to the exec line. It seems such a solution would work beautifully for all Gnome-based desktops. I believe KDE also has an autostart folder ( ./kde/autostart I believe).

Actually I just learned that kde will also look in the ~/.config/autostart as well for .desktop files. Is it possible to go the route of Geary, and add the checkbox? It would really just need to drop a copy of the .desktop file into /.config/autostart with the --hidden appended to the exec command. It seems simple enough and should work for Ubuntu/Gnome/Kde and those variants within, aka the vast majority of Linux users.

@brittyazel It is possible to go the route and add support for the checkbox, but it is a hassle to support more than one desktop environment.

I see most Linux users here use GNOME, KDE, or i3. Geary was targeted at GNOME users, which is why that flag was present. N1 is targeted at the larger audience. I wonder what @bengotow would have to say.

Yes but I believe the same technique could be used for all Gnome and KDE desktops. They both use the same method and folder for autostarting applications. I can not speak for i3.

I could see a solution being an implementation of the checkbox, which drops the appended .desktop file into /.config/autostart, with a note to i3 users that they will need to manually add the "exec nylas --background" to their config file manually. Which shouldn't be a problem for i3 users anyway, as to be an i3 user in general means that editing config files is up your alley.

Hmm. From my research on the awesome Arch Linux Wiki, I found that the XDG directory is the best solution for the Linux side (source).

N1 could display a notification to all Linux users that they need an XDG-compliant environment (e.g. Unity, GNOME, or KDE) for launch at startup. If they need support under other environments, they need dapper, dex, or fbautostart.

Yes /.config/autostart is XDG compliant.

User-specific: $XDG_CONFIG_HOME/autostart/ (~/.config/autostart/ by default)

If the checkbox is user configurable from within the application, /etc/xdg/autostart/ is off limits unless the app is run with administrator permission, which would be terrible. Thus dropping the appended .desktop file in /.config/autostart ($XDG_CONFIG_DIRS/autostart/) is the only rational option if this route is to be pursued.

Using Ubuntu 15.10 here.
After installing Nylas a .desktop file was put into my /usr/share/applications folder :) That is great!
When I put it in the startup applications with this line to be executed "/usr/share/nylas/nylas %U" it starts nylas at start. But not minimized. I tried your tip with the arguments --background or --hidden but sadly both did not managed to let it start in the background.
Any other command line tip how I could manage that? Thanks in advance

@Feichtmeier --background is the argument needed to run N1 in the background. I have tested the argument and it works as intended. Does Ubuntu have a startup editor to enter this in manually?

Yes it has. There you can either put a full path to an executable or put a path variable like "firefox" or "plank". But if you put "nylas --background" in there nothing happens.
When I put "/usr/share/nylas/nylas %U" which also is given in the nylas.desktop file, nylas starts at start but normally with all windows and not in the background ofc.

When you type "nylas --background" into the shell you get this response:

image

@Feichtmeier That should have been fixed in the latest version. What version of N1 are you on? The most recent version is 0.4.10, which includes #593.

Whoops. Accidentally clicked "Comment & Close Issue".

I am running version 0.4.10-4e3595b

The nylas installer added nylas to my ubuntu repos so I think I should always
be up to date. But still, the pictures I uploaded is from today :) So, should
I maybe reinstall nylas? Or change my OS? :P

@Feichtmeier That is the latest version. Hmm... I suggest reinstalling Nylas, but you do not need to remove ~/.nylas.

I purged nylas then did a fresh install from a fresh download and sadly still the same output:
frederik@akira:~$ nylas
Can't find the Electron executable at /usr/bin/electron/electron. Be sure you have run script/bootstrap first from /usr/bin or set the ELECTRON_PATH environment variable.
Maybe I need to installe some additional package?

Edit: okay since the last nice nylas update, it suddenly works to start nylas from terminal and also with --background. But... it only hides that little "start" frame but then shows the main frame. How can I disable the frames at all and just start it really in the background with only the indicator enabled? :)

That is not what N1 intended. I am able to start to only the background with nylas --background from the command line. I assume you are using Unity since you are using Ubuntu.

Yes I am using Unity. So you do not have the main frame opened after system start?

I am going to try rebooting and having nylas --background listed in i3's configuration as exec /usr/bin/nylas --background.

My i3 configuration is available at https://gist.github.com/mbilker/dae19ee4f1a49af4a29a

Helped me in Ubuntu 15.10:
in gnome-session-properties add entry /usr/bin/nylas --background
Nylas 0.4.14

I do not have the main frame open at system start with that i3 configuration. The tray icon does appear.

Well it still opens the mainframe after adding /usr/bin/nylas --background to gnome-session-properties But maybe this has something to do with my Ubuntu installation? I don't really know. I will update to 16.04 as soon as it is officially released and I can report if this is still the case.

Edit: same issue on Ubuntu 16.04 beta 2. After adding /usr/bin/nylas --background or nylas -b or nylas --background to startup applications it still does not start in the background it only hides the loading screen

https://docs.google.com/uc?id=0BweBBOYdSgGIZVExS1dWZ1dCS1E&export=download

Edit 2: OK! I reinstalled it again yesterday and it works now :) for Some reason, sometimes it does not work though. When I reinstall it it works again

I'm working on this at the moment and thought about how to implement this. Since in the build process there is already a nylas.desktop generated I think we can read that file, make a few changes to it like adding the --background flag and then write to the user's XDG home directory.

What do you all think?

I think that is a great idea. I would love to be able to have nylas n1 autostart

@brittyazel could you test the branch that's referenced in the PR?

I'm not sure how to do that exactly. I wasn't building from source before, but rather just using a prebuilt package in the AUR.

Oh well maybe somebody else can test on Arch? @mbilker?
I've tested it on Ubuntu 14.04.

@Siilwyn I do not use a WM that supports autostart via the normal XDG way. I can test the --background command line option via i3's configuration.

@Siilwyn I see your PR now. I will test to see if it puts the .desktop file in the correct place.

@mbilker it won't work, I've implemented it the XDG way. I guess we'll just wait for a reaction on the PR of one of the core developers then.

Wouldn't integrating an existing cross-platform tool with wide support be better than creating your own?

I came across this a few days ago: https://github.com/Teamwork/node-auto-launch

@KevinMartin if there is a good cross-platform tool to do this then maybe. But as of now, no I don't think so. The node-auto-launch does not have error handling, does not respect the XDG environment variables and uses a static version number (which is even spelled incorrectly).

Hey folks— @Siilwyn's pull request above was merged in and shipped in 0.4.32. You can grab the update from the Releases page, and it should hit the auto-updaters today. Cheers!

Is it possible to launch on system start minimized to tray instead of opening the window?

Edit: The -b or --background flags aren't working. Using nylas 0.4.45-76...
Edit2: Ok, the launch command was wrong with %U that needs to be removed [DONE, it works.]

bengotow commented

Hey folks— @Siilwyn's pull request above was merged

This feature is no longer working! Seems it's buggy as it has been described well at #3464

Although stated as fixed since 0.4.32, I can confirm this issue on snap release 1.6.3-134a0e55 and Ubuntu 19.04.
There is no checkbox present in the app, only note that auto startup works only in XDG compliant environments.

This works for me:

ln -sf /var/lib/snapd/desktop/applications/mailspring_mailspring.desktop ~/.config/autostart/mailspring.desktop

= Which symlinks .desktop file so it's available in user startup.

In order to get the option for "Launch on system start" I had to remove snap package and install the deb package directly from the mailspring site.

Now I have the system tray icon and starts in background!

Im using Ubuntu 19.10
Mailspring 1.7.2

I just added mailspring in autostart and it works well :+1:

Kubuntu 20.04
Mailspring 1.7.6 installed via Snap

I can confirm that the following command from xZero707 does work for Mailspring 1.7.8 installed via Snap:

ln -sf /var/lib/snapd/desktop/applications/mailspring_mailspring.desktop ~/.config/autostart/mailspring.desktop

:+1:

It would be nice if Mailspring supported this functionality out of the box for the Snap, maybe one day, who knows.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nihil21 picture nihil21  Â·  4Comments

gerardcuadras-zz picture gerardcuadras-zz  Â·  3Comments

hazim1093 picture hazim1093  Â·  4Comments

JeroenBoersma picture JeroenBoersma  Â·  4Comments

hfossli picture hfossli  Â·  3Comments