7

I have read that adding a .desktop file to /etc/xdg/autostart can start an application at startup. I did the same to execute my application. But nothing happens on startup. Following is the content of my .desktop file:

[Desktop Entry]
Type=Application
Encoding=UTF-8
Version=1.0
Name=screenshot
Exec=/home/anaswara/eclipse_agent/bin/Screenshot
X-GNOME-Autostart-enabled=true
X-KDE-autostart-after=panel

Can anybody tell what is going wrong(Ubunu 14.04)

7
  • Is /home/anaswara/eclipse_agent/bin/Screenshot an executable and working fine with terminal? or Is this .desktop works with normal way?
    – Pandya
    Jan 22, 2016 at 5:28
  • that is an executable and works from terminal
    – Jackzz
    Jan 22, 2016 at 5:29
  • And .desktop file also works right?
    – Pandya
    Jan 22, 2016 at 5:30
  • 1
    Just double-click to run from file manager
    – Pandya
    Jan 22, 2016 at 5:31
  • 1
    it gives Untrusted applicatiion launcher error
    – Jackzz
    Jan 22, 2016 at 5:32

2 Answers 2

4

My standard debugging flow for desktop entry file (.desktop application):

  • file format - check if the desktop entry follow the spec of freedesktop.
  • executable command - if the previous check looks good, try your command of Exec in a terminal directly.
  • executable as expected - if the previous check looks good, then double click the .desktop with your mouse.
  • executing environment - if the previous check looks good, it means your execution command and .desktop should at least run in your desktop environment. Put it under ${HOME}/.config/autostart will definitely work.

[Additional Information]

  1. What if it does still not work with all check passed and .desktop has been in ${HOME}/.config/autostart?
    • You may consider to redirect logs from your Exec in .desktop to see what special application behavior raised by your executable.
  2. Why does ${HOME}/.config/autostart work but not /etc/xdg/autostart?
    • There are possible root causes. The most common case is that your executable needs to read or manipulate user-specific files/directories/config/cache/environment. For example, an autostart applet wants to write something in $HOME/.cache. Trigger .desktop in $HOME/.config/ will make sure the executable is triggered with a known $HOME.
2

Copy and Paste the .desktop file to /home/'user'/.config/autostart/, e.g. /home/rumi/.config/autostart/app.desktop where rumi is the user and app.desktop is the .desktop file.

Should work fine.

2
  • 18
    how to debug if "should work fine" becomes "doesn't work fine"?
    – pcnate
    Oct 29, 2017 at 3:45
  • 1
    Worked for me on Ubuntu 16.04. Copied some desktop file that chrome created using the "Add to desktop" feature. Mar 26, 2018 at 13:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .