6

I have a snapcraft application build on top of electronJs. I would like that application to run on startup.

I tried to directly drop a app_name.desktop file inside the current user config/autostart path but I was not able to do it from within my code, I got a right access issue which means I am not allowed to perform such action. I noticed inside the snap folder there is a .config. I thought that dropping my .desktop file there should work but nothing.

Is there a way to run my snap application on startup? Is there a command I should add to my .yml file or is there a way to do it directly from my code?

Here is my config

[Desktop Entry]
 Type=Application
 Terminal=false
 Exec=/snap/bin/rightplayer
 X-GNOME-Autostart-enabled=true
 StartupNotify=false
 Name=myapp
4
  • @pomsky i just did it Jul 30, 2018 at 10:47
  • Try changing Exec=snap run myapp to Exec=/full/path/to/the/executable.
    – pomsky
    Jul 30, 2018 at 10:49
  • Doesnt work. That was the first thing I did. In fact I tried that command manually and it works. But When I try to do it whithin my code I get a right access issue. Seems I cant do it. Then I decided to add that config inside snap config itself but it doesnt work either Jul 30, 2018 at 10:51
  • 1
    Maybe read thru here, see what's up forum.snapcraft.io/t/…
    – doug
    Jul 30, 2018 at 21:28

1 Answer 1

9
  • Get the exact path of the snap location you wish to execute. You can do that by executing the following in the Terminal -

    which nameOfSnap
    /usr/bin/nameOfSnap    #copy this path
    
  • Search for "Startup Applications" from the Launcher enter image description here

  • Click on add. Paste the path in the command textbox. You can provide any name, comment. enter image description here

  • Click on "Add" at the bottom and the snap will be added to your startup applications.

Reference - How do I start applications automatically on login?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.