Skip to content

"Launch on system start" not available on Linux #1251

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

Closed
brittyazel opened this issue Feb 9, 2016 · 42 comments
Closed

"Launch on system start" not available on Linux #1251

brittyazel opened this issue Feb 9, 2016 · 42 comments
Labels

Comments

@brittyazel
Copy link

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

@mbilker
Copy link
Contributor

mbilker commented Feb 9, 2016

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.

@brittyazel
Copy link
Author

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 :-/

@mbilker
Copy link
Contributor

mbilker commented Feb 9, 2016

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.

@brittyazel
Copy link
Author

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).

@brittyazel
Copy link
Author

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.

@mbilker
Copy link
Contributor

mbilker commented Feb 9, 2016

@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.

@brittyazel
Copy link
Author

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.

@brittyazel
Copy link
Author

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.

@mbilker
Copy link
Contributor

mbilker commented Feb 9, 2016

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).

@mbilker
Copy link
Contributor

mbilker commented Feb 9, 2016

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.

@brittyazel
Copy link
Author

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.

@Feichtmeier
Copy link

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

@mbilker
Copy link
Contributor

mbilker commented Mar 10, 2016

@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?

@Feichtmeier
Copy link

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

@mbilker
Copy link
Contributor

mbilker commented Mar 10, 2016

@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.

@mbilker mbilker closed this as completed Mar 10, 2016
@mbilker mbilker reopened this Mar 10, 2016
@mbilker
Copy link
Contributor

mbilker commented Mar 10, 2016

Whoops. Accidentally clicked "Comment & Close Issue".

@Feichtmeier
Copy link

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

@mbilker
Copy link
Contributor

mbilker commented Mar 10, 2016

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

@Feichtmeier
Copy link

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? :)

@mbilker
Copy link
Contributor

mbilker commented Mar 12, 2016

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.

@Feichtmeier
Copy link

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

@mbilker
Copy link
Contributor

mbilker commented Mar 12, 2016

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

@eldarkg
Copy link

eldarkg commented Mar 13, 2016

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

@mbilker
Copy link
Contributor

mbilker commented Mar 13, 2016

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

@Feichtmeier
Copy link

Feichtmeier commented Mar 14, 2016

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

@Siilwyn
Copy link
Contributor

Siilwyn commented Apr 11, 2016

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?

@brittyazel
Copy link
Author

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

@Siilwyn
Copy link
Contributor

Siilwyn commented Apr 21, 2016

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

@brittyazel
Copy link
Author

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.

@Siilwyn
Copy link
Contributor

Siilwyn commented Apr 21, 2016

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

@mbilker
Copy link
Contributor

mbilker commented Apr 21, 2016

@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.

@mbilker
Copy link
Contributor

mbilker commented Apr 21, 2016

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

@Siilwyn
Copy link
Contributor

Siilwyn commented Apr 21, 2016

@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.

@kevinmartin
Copy link
Contributor

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

@Siilwyn
Copy link
Contributor

Siilwyn commented Apr 21, 2016

@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).

@bengotow
Copy link
Contributor

bengotow commented May 3, 2016

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!

@leoheck
Copy link

leoheck commented May 29, 2016

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.]

@parsedarweb
Copy link

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

@xZero707
Copy link

xZero707 commented Aug 12, 2019

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.

@hernandez87v
Copy link

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

@vanushwashere
Copy link

vanushwashere commented May 17, 2020

I just added mailspring in autostart and it works well 👍

Kubuntu 20.04
Mailspring 1.7.6 installed via Snap

@ipkpjersi
Copy link

ipkpjersi commented Jul 31, 2020

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

👍

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests