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)

Pandya
  • 23,898
  • 29
  • 92
  • 144
Jackzz
  • 1,363
  • 3
  • 15
  • 21

2 Answers2

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.
tai271828
  • 141
  • 2
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.

Kusalananda
  • 320,670
  • 36
  • 633
  • 936
smearumi
  • 29
  • 4